C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Errors and Solutions » General »

Avoid Back button after logout.


Posted Date: 31 Dec 2008    Resource Type: Errors and Solutions    Category: General
Author: rahulagrawalMember Level: Silver    
Rating: 1 out of 5Points: 2



There are so many questions related to this topic.

the answer is simple.

just put this code from where user clicks log out page



and dont forget to write this on code behind page of log out page

Session.Abandon();
FormsAuthentication.RedirectToLoginPage();



Responses

Author: guru prasad    20 Jan 2009Member Level: Gold   Points : 0
Thank you.....


Author: savithri    21 Jan 2009Member Level: Silver   Points : 1
But i didnt understand where the code to be placed. Could you please explain to me.. Thanks


Author: One Earth    22 Apr 2009Member Level: Gold   Points : 2
Place the following code on the logout button event


protected void lnkbtLogOut_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Session["UserInfo"] = null;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Session.Clear();
Session.Abandon();
Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
Response.Redirect("~/Login.aspx", true);
}





Author: sri    22 Oct 2009Member Level: Silver   Points : 2
Hi i tried this logout code its working fine
but when we click the back button it should not redirect
the page but here the page is redirecting the page and logout link is appear. I dont want to get like this if the back button is clicked the page should not redirect to the logout page....
can anyone help


Author: sri    24 Oct 2009Member Level: Silver   Points : 1
place the following code in logout page with in load function
i hope it will be useful.

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Log out  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: The type or namespace name ‘type/namespace’ could not be found
Previous Resource: ThreadAbortException exception
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use