Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii..I have made an Asp.net(C#) login.aspx page and then by logging in I am redirecting to user.aspx page..now from user.aspx page when i am logging out i again come back to login.aspx page.I am using SQL server as a data base in which i have a table login
My problem is at this point when I am pressing browser's back button I am again redirecting to user.aspx page. This is not valid as we can only move to user.aspx page only after logging in.
How can i solve this problem. Can anyone provide me with this solution. I am using C# as my language in asp.net.
Please send me a snippet.I need it badly.Pls help
my id- rockthaworld123@gmail.com
Posted
Updated 2-Jul-13 11:11am
v3

Hi rockthaworld123,

One thing i need from u r side regarding of this. you need back button pressing facility while user pressing logout option. if u dont need means simply u can disable back button facility , but it is browser dependability. By using following code you can disable back button press feature in your application


window.history.forward();
function noBack() { window.history.forward(); }



onpageshow="if (event.persisted) noBack();" onunload="">

and you need backbutton facility means simply redirect home page when the user press back button in your application

Might be it will help to you


Thanks and Regards,
Pallamalli Maruthi
 
Share this answer
 
Another solution is, use no cache in all of your pages. It forces the browser to reload user.apsx instead of reading from cache.
First, use these code in your header:
XML
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">

Secondly, you must ensure that your user.aspx doesn't allow to open directly without a valid session.
 
Share this answer
 
Try this,,,,:)

C#
Session.Clear();//clear session
Session.Abandon();//Abandon session
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Redirect("yourUrl.aspx");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900