1. There are multiple ways to this, but possibly the best way in ASP.NET is to have a session variable set.
Then check for value of the session variable in page_init or page_load and direct the user accordingly.
Then check for value of the session variable in page_init or page_load and direct the user accordingly.
2. Another situation is when the user has to be directed to a certain page in the website. If x occurs, redirect user to a certain page. And then, don't let him out of that page if he doesn't make a selection. Java script has a solution to this:
window.onbeforeunload = function UnLoadWindow() {
return 'Please completed the selected.'
};
But this still gives the user the option to leave:
But Session variable solves this too. And check for this variable in every other page of your website or on the master pages. If the variable exists and has the appropriate value, redirect user back to the page. For e.g. suppose we want to take the user to a completed page once his application for a loan is completed. Now we don't want the user to navigate to any other page in the website, until the officer process his documents. We can set a session variable:
Session["complete"]= True;
And check in all the other pages:
if(Session["complete"].ToString()=="True")
Response.Redirect("complete.aspx");
No comments:
Post a Comment