Automate the back

  • Thread starter Thread starter Samuel Shulman
  • Start date Start date
S

Samuel Shulman

Hi

How can I auomate the 'Back' ie if anything fails return the user to the
previous page

Thank you,
Samuel
 
How can I auomate the 'Back' ie if anything fails return the user to the
previous page

Not sure what you mean exactly... Do you mean Response.Redirect()...?

E.g. if you have a form with some controls which the user fills in, then
hits a "Save" button which creates a new record in a database, if the data
is invalid in some way wouldn't you want to stay on the current page so that
the data is preserved in ViewState and you could pop an alert telling the
user which field(s) contained the invalid data? Then the user could amend
the invalid data and try again...?
 
I do something in the Load Event of the form (it must be in the Load event)
and if it fails the user must load the page again

One way is by sending the user to the page where he came from

Thank you
Sam
 
I do something in the Load Event of the form (it must be in the Load event)
and if it fails the user must load the page again

Er, OK...
One way is by sending the user to the page where he came from

Are you able to use Request.ServerVariables["HTTP_REFERER"].ToString()?
Whereas this can't be relied upon for the initial connection to an external
ASP.NET site, once the Session has started it might work well enough...
 
If you need to load the page again because of something not "working"
programmatically, why can't you just have code that does a
Response.Redirect
(or even Server.Transfer - more efficient) back to the same page?

Indeed - see my first reply...
 
The problem with this that if the problem will linger then it will never
stop

But in second thought I can use a session variable to count and stop as
necessary

Thank you all
Samuel
 
Back
Top