Why logout does not work in ASP.NET
Manually session check to enter in a web page in asp.net. It works fine.When logout, works fine. But, after logout , when press browser back button it back to the previous page, session check not work.Why?
code for page_load() with session check:
protected void page_load()
{
if(session["id"]==null)
{
server.Transfer("../Index.aspx");
else
{
// ....
}
}
}
code for logout button:
{
session["id"]=null;
server.Transfer("../Index.aspx");
}
Re: Why logout does not work in ASP.NET
you have to use javascript for disable back button.
<head runat="server">
<script language="javascript">
history.forward();
</script>
Re: Why logout does not work in ASP.NET
Add [B]Session.Abandon();[/B]
code for logout button:
{
session["id"]=null;
Session.Abandon();
server.Transfer("../Index.aspx");
}