ASP.Net Logout issue
-
Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba
-
Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba
Well, you can just check on page load that if user is logged in then display the page. Otherwise redirect to login page or display alert message that please login. There is no requirement of Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") Let me know if you have any doubts. thank you.
Regards Keyur Satyadev
-
Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba
when the users log on set a session for your users, and check session in target pages, and when user log out just remove that session!
Session.Add("userID",ID);
Session.Remove("userID");for checking session:
if(Session["user"]!=null)
{
//do your works
}
else
{
Response.Redirect("default.aspx");
} -
Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba
Check this Tip/Trick Browser back button issue after logout[^]
thatraja
FREE Code Conversion VB6 ASP VB.NET C# ASP.NET C++ JAVA PHP DELPHI ColdFusion
HTML Marquee & its alternativesNobody remains a virgin, Life screws everyone :sigh:
-
Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba
Try this - Logout button event:
String pageUrl = "";
pageUrl = Request.Url.ToString();
Session.Abandon();
Response.Redirect(pageUrl);- And in other page that need session to work try
protected void Page_Init(object sender, EventArgs e)
{
Response.Cache.SetNoServerCaching();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00));
}