S
steve.chambers
Here's the short version of this question:
When loading a page if Page.IsPostback is true, is there any way of
removing the POST parameters so the page would be loaded as a normal
GET request instead?
And here's the longer version...
I've recently added some code to a web application to prevent old
postbacks from being submitted e.g. in order to stop the dangerous
possibility of a delete operation from happening twice simply by
navigating back to an old page with POST parameters. In practice this
was implemented by detecting old postbacks in the OnLoad event and
then redirecting to the same page as a GET instead of a POST rather
than displaying a message to the user (since they probably would want
to do this anyway and would only be confused by any kind of error
message about an old postback). This is now working but the only
slight problem is that there are now 2 entries in the history for the
same page due to the redirect to self - am using SmartNavigation so
this doesn't happen elsewhere. Ideally would like to remove the second
entry from the history. The redirect happens from the server side so a
javascript window.replace() can't be used here. The only way I can
think of doing it is not to actually redirect when an old postback is
detected but instead to remove the postback information and load the
page normally.
Hope that's clear!
Any suggestions gratefully received...
Cheers
Steve
When loading a page if Page.IsPostback is true, is there any way of
removing the POST parameters so the page would be loaded as a normal
GET request instead?
And here's the longer version...
I've recently added some code to a web application to prevent old
postbacks from being submitted e.g. in order to stop the dangerous
possibility of a delete operation from happening twice simply by
navigating back to an old page with POST parameters. In practice this
was implemented by detecting old postbacks in the OnLoad event and
then redirecting to the same page as a GET instead of a POST rather
than displaying a message to the user (since they probably would want
to do this anyway and would only be confused by any kind of error
message about an old postback). This is now working but the only
slight problem is that there are now 2 entries in the history for the
same page due to the redirect to self - am using SmartNavigation so
this doesn't happen elsewhere. Ideally would like to remove the second
entry from the history. The redirect happens from the server side so a
javascript window.replace() can't be used here. The only way I can
think of doing it is not to actually redirect when an old postback is
detected but instead to remove the postback information and load the
page normally.
Hope that's clear!
Any suggestions gratefully received...
Cheers
Steve