Hi,
After user has logged out i am redirecting user to home.aspx and from here i do not want user to be able to go back using browser back button.. How can i do it? I used this code in javascript :
This does not work for me. In all pages i am using Master Pages..
Thanks for the help in advance
Loading

Sam HobbsPosted Jan 18, 2012, 3:20 AM
Prabhu RajaPosted Jan 17, 2012, 1:33 PM
When You logged out, Execute these Codes
Session.Abandon();
Session.Clear();
And you mentioned,that you are using Master Page for All Pages. So, you can include these Codes in Page_Load() of Master Page,
if (Session["UserName"] == Null)
{
Session["ErrMsg"] = "Session Expired or Access Denied please login";
Response.Redirect("../Login.aspx");
}
Gohil JayendrasinhPosted Jan 17, 2012, 10:26 AM
kishorePosted Jan 17, 2012, 6:51 AM
protected void Page_Init(object Sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
}
B M SuchitraPosted Jan 17, 2012, 4:31 AM
After google i thought someone here could help me..
I know the disadvantages of javascript so did not go with it.
Suthish NairPosted Jan 16, 2012, 7:58 AM
The couple of ways you can handle the back button..
1. Use above javascript code in Page Init of each web pages.
Create an overirde method of OnInit and using Registerstartupscript adds Javascript to the web form. The disadvantage, if the Java Script is not working on client system then this method is of no use.
2. The best and recommended method is using Response.Cache.
Lots of samples avaliable, please browse...
Jignesh TrivediPosted Jan 16, 2012, 6:39 AM
Frame base architecture means that one page having frame and all pages are open and redirect within frame. so url of your browser not change.
also refer
http://stackoverflow.com/questions/6200647/handle-browser-back-button-with-javascript-different-approach-possible-by-usin
https://github.com/balupton/History.js
in this post they are talking about mantain history using jquery
hope this help.
B M SuchitraPosted Jan 16, 2012, 6:23 AM
Sorry i did not get what you said?
Jignesh TrivediPosted Jan 16, 2012, 6:19 AM
this is not possible in higher version of browser.
but I have temp solutionfor same.
you use frame base architecture.Load all page with in frame.
but please check frame is working on all browser?
hope this help.