webpage has expired after file upload

K

kennedystephen

I have a web app that allows a user to upload/submit a file. After
upload completes, the user is taken back to the same page
(upload.aspx) in order to upload another file. At that point, if the
user leaves the web application and goes to another web page, and then
hits the browser's back button expecting to return to the upload page,
they get "Webpage has expired" message back from IIS.

I'd like to be able to programmatically handle this error. Meaning, if
the page is expired, I'd like for it to just response.redirect back to
the original upload.aspx.

Alternatively, is it possible to create a custom HTTP error page in
IIS for the "Webpage has expired" page. If so, what filename/number is
it in IIS? I'll replace it with a custom page that response.redirects
back to upload.aspx.

Any help would be appreciated, as this thing is kicking me .... hard.

Thanks,
- Steve
 
G

George Ter-Saakov

"Web Page expired" does not come from IIS. It comes from the browser.
Hence you can not handle it on a server.

Browser shows that message when displayed page is result of method "POST".
So when you navigate away from that page and then hit "back" browser must
submit data again (do a POST) in order to show you same page. And browser
gives you a warning to let you know that data will be submitted again.

Solution is to finish every action with Response.Redirect to Request.RawUrl.
So when file is uploaded method POST happens. Then you Responsd.Redirect to
itself and it's going to be method GET. So when user went away from your
page and then hit back he will end up on the page that was a result of
method "GET".
So no warning displayed.




George.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top