Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET Error redirect then use Back button (or programmed button)

Reply
Thread Tools

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

 
 
phancey
Guest
Posts: n/a
 
      02-21-2008
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 SavePageStateToPersistenceMedium 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
 
Reply With Quote
 
 
 
 
Aidy
Guest
Posts: n/a
 
      02-21-2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 SavePageStateToPersistenceMedium 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
>



 
Reply With Quote
 
 
 
 
phancey
Guest
Posts: n/a
 
      02-22-2008
On Feb 21, 5:16*pm, "Aidy" <(E-Mail Removed)> wrote:
> 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 theerroras appropriate.
>
> "phancey" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > hi,

>
> > I've got anasp.netapp. In case of unhandled exceptions, the
> > web.config is set up toredirectthe user to anerrorpage. 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 SavePageStateToPersistenceMedium 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 anerrorthen i cannot
> > rely on the dataset (as this could be the cause of theerror), 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 theerroron the page but this was a backup for unhandled
> > exceptions.

>
> > Any help appreciated.
> > Phil- Hide quoted text -

>
> - Show quoted text -


Yes it is for an unhandled exception. That's the point though. Unless
it was one that I was expecting I wanted to take them off to a
standard error page that told them to contact the Helpdesk if it
happened again. Sure, I can put try catches around everything but then
there wouldn't be any unhandled exceptions so the setting would be
pointless. On the assumption that the setting is useful and that there
are therefore some unhandled exceptions, how can I prevent them from
losing all their entry after they have been redirected to the error
page?

thanks
Phil
 
Reply With Quote
 
Aidy
Guest
Posts: n/a
 
      02-23-2008
> how can I prevent them from
> losing all their entry after they have been redirected to the error
> page?


I don't think there is a way. Like I said, if you think your code might
throw an exception then handle it properly. I'm assuming the exception is
things like duplicate data violating database integrity, or null values in
fields etc. If so you should code around those issues rather than just
letting the error handle page pick them up.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use classes programmed in ADA in a class programmed in JAVA? ogalve Java 3 02-07-2007 02:09 AM
Is cisco IOS programmed in forth? sqrfolkdnc Cisco 16 09-20-2005 05:44 PM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
How are MSDN Newsgroups programmed? =?Utf-8?B?U2FuZHk=?= ASP .Net 4 02-14-2005 05:52 AM
Free Games Programmed in C++? Pandora Xero C++ 4 08-11-2003 06:23 PM



Advertisments