# Web Development > ASP.NET Why logout does not work in ASP.NET

## ahsanm

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");
}

----------


## aditi.ptl

you have to use javascript for disable back button.

----------


## sandu

Add *Session.Abandon();*
code for logout button:
{
session["id"]=null;
Session.Abandon();
server.Transfer("../Index.aspx");
}

----------

