0
Session.Abandon();
Session.Clear();
Session["user"]=null

i m trying to clear a Session but these methods are not working..how can i clear this Session plz help me.. thnxx

Edited by MrBlack: n/a

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by prit005
0

In order to completely erase it from memory: Session.remove("YourSessionName").

In order to clear its data if it's a basic string: session("YourSessionName") = ""

0

In order to completely erase it from memory: Session.remove("YourSessionName").

In order to clear its data if it's a basic string: session("YourSessionName") = ""

This is also not working

0

Don't use #2 and #3 line statements. Use Session.Abandon() method.

this is also not working...

this is my code

protected void Page_Load(object sender, EventArgs e)
    {
   if (Session["user"] != null)
        {
//some codes
            
        }
        else
        {

            Response.Redirect("Default.aspx");
        }
}



protected void Button1_Click2(object sender, EventArgs e)
    {

     
      
        Session.Abandon();
        Response.Redirect("Default.aspx");
    }

try to kill but still it is alive....
0

I guess you want to disabled the cache.

Write following line in page_load handler.

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Edited by __avd: Added a link.

0

Session.Remove("User");
hope so it works

To remove all Session variable use

Session.Removeall();

Edited by prit005: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.