How to disable browser back button when "logout" button click event executes.
Thanks & Regards
Manohar
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Lalit MRank #1,186 · 1.5K reputationPosted Apr 26, 2010, 8:57 PM EDT
show this link will get your solution
http://geekswithblogs.net/vivek/archive/2007/02/24/107148.aspx
http://forums.asp.net/t/1401145.aspx
http://aspalliance.com/694_Preventing_Page_Review_after_Logout_with_Forms_Authentication.all
Raghvendr Singh81 reputationPosted Apr 26, 2010, 9:10 PM EDT
To meet your requirement there is need to add two page login.aspx and logout.aspx. Write the code eg. Response.Redirect("logout.aspx") on logout button that redirect you to Logout.aspx page.On logout.aspx page write this code.
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.Append("");
Page.RegisterClientScriptBlock("disable", sb.ToString());
}
when ever you redirect on logout.aspx page the above code at once redirects to login page and at seems that you are always on login page.
tango charlie6 reputationPosted Apr 26, 2010, 11:46 PM EDT
{
Session.Abandon();
FormsAuthentication.SignOut();
Response.Cookies["TestCookies1"].Expires = DateTime.Now.AddYears(-1);
Response.Cookies["TestCookies2"].Expires = DateTime.Now.AddYears(-1);
Response.Redirect("~/login.aspx");
}
Try this on logOut, It wud help u and still thr is same issue then
try this after writing upper portion. (its customized method of doing the same :) )
write a method on the load of masterpage
function GoBack() {
if (document.cookie == "")
document.location = '<%=HttpContext.Current.Request.ApplicationPath%>' + "/login.aspx";
}
Don't forget to mark it as answer, if it works....
ritesh shah2 reputationPosted Mar 25, 2011, 12:55 AM EDT
lilima baisak3 reputationPosted Mar 25, 2011, 2:34 AM EDT
Response.AddHeader("Pragma","no-cache");
Response.Expires = -1;
This will make the browser go to the server everytime the back button is clicked (for that particular page) and prevent any caching of the pages
Suthish NairRank #92 · 22.8K reputationPosted Mar 25, 2011, 3:29 AM EDT
vijay172 reputationPosted Mar 25, 2011, 5:40 AM EDT
http://vbdotnetaddict.blogspot.com/2011/02/how-to-disable-back-button-in-aspnet.html