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


Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2012, 1:19 AM EST
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.
B M SuchitraRank #2,922 · 492 reputationPosted Jan 16, 2012, 1:23 AM EST
Sorry i did not get what you said?
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2012, 1:39 AM EST
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.
Suthish NairRank #92 · 22.8K reputationPosted Jan 16, 2012, 2:58 AM EST
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...
B M SuchitraRank #2,922 · 492 reputationPosted Jan 16, 2012, 11:31 PM EST
After google i thought someone here could help me..
I know the disadvantages of javascript so did not go with it.
kishore3 reputationPosted Jan 17, 2012, 1:51 AM EST
protected void Page_Init(object Sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
}
Gohil JayendrasinhRank #490 · 5K reputationPosted Jan 17, 2012, 5:26 AM EST
Prabhu RajaRank #861 · 2.6K reputationPosted Jan 17, 2012, 8:33 AM EST
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");
}
Sam HobbsRank #107 · 20.5K reputationPosted Jan 17, 2012, 10:20 PM EST