ASP.NET Error redirect then use Back button (or programmed button)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • phancey

    ASP.NET Error redirect then use Back button (or programmed button)

    hi,

    I've got an asp.net app. In case of unhandled exceptions, the
    web.config is set up to redirect the user to an error page. If the
    user then clicks the back button to retry, they have lost all the data
    they entered. This could be quite a lot of data. Is there a way to
    handle this? I tried SavePageStateTo PersistenceMedi um but the
    LoadPageState is not fired when going back so this doesn't work. And
    the back button only works if I set Cacheability to NoCache.

    If the page is redirected by me (which it is on a successful post)
    then I store the info in a dataset Session variable and provide the
    user with a Back button that restores the page using the Session
    variable. But if the redirection is because of an error then i cannot
    rely on the dataset (as this could be the cause of the error), but how
    do I stop the user losing the data.

    I could remove tha automatic redirection from the config file and put
    in a global page_error handler that issued a javascript alert or just
    showed the error on the page but this was a backup for unhandled
    exceptions.

    Any help appreciated.
    Phil
  • Aidy

    #2
    Re: ASP.NET Error redirect then use Back button (or programmed button)

    Surely those settings are only for unhandled exceptions? If there is a
    chance your code will throw an exception, just put it in a try/catch block
    and handle the error as appropriate.

    "phancey" <deja@2bytes.co .ukwrote in message
    news:7c6a7442-3f78-4a1c-8c0c-a9e59738410c@60 g2000hsy.google groups.com...
    hi,
    >
    I've got an asp.net app. In case of unhandled exceptions, the
    web.config is set up to redirect the user to an error page. If the
    user then clicks the back button to retry, they have lost all the data
    they entered. This could be quite a lot of data. Is there a way to
    handle this? I tried SavePageStateTo PersistenceMedi um but the
    LoadPageState is not fired when going back so this doesn't work. And
    the back button only works if I set Cacheability to NoCache.
    >
    If the page is redirected by me (which it is on a successful post)
    then I store the info in a dataset Session variable and provide the
    user with a Back button that restores the page using the Session
    variable. But if the redirection is because of an error then i cannot
    rely on the dataset (as this could be the cause of the error), but how
    do I stop the user losing the data.
    >
    I could remove tha automatic redirection from the config file and put
    in a global page_error handler that issued a javascript alert or just
    showed the error on the page but this was a backup for unhandled
    exceptions.
    >
    Any help appreciated.
    Phil
    >

    Comment

    Working...