Add Object to the Session State:
HttpSessionState.Session.Add(name, Value)
Assign a value to a Session object
HttpSessionState.Session["UserName”] = “Sg”;
Reading from a session object:
string userName = HttpSessionState.Session["UserName”].ToString();
Remove an object from session:
HttpSessionState.Remove(objName);
Clear the session
Session.Abandon() or Session.Clear()
Session.Abandon : Calls Session_End will be fired
Session.Clear : Just clears the session data without killing it
Enable/Disable Session state at Page Level:
Page Level : <%@ Page EnableSessionState=”False” %>
Page Level ReadOnly : <%@ Page EnableSessionState=”ReadOnly” %>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment