Session
how to use session? with example practically please help me.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SenthilkumarPosted Mar 14, 2012, 1:59 AM
Session["Key"] = value;
The session is the key word and it has the two parts. Key and Value. The value can be assigned and accessed using the session key. The value will be stored as object. It has to be type casted.
Session["UserDataSet"] = dsUsers;
when you retrieve and assign back to the dataset then
DataSet dsUsersData = (DataSet) Session["UserDataSet"];
The session mode can be set to the application level or machine level.
The configuration file allows you to set the mode of session saving.
The SessionState configuration tag is available in the web.config.
The Session state can be InProc, StateServer, SqlServer.
when you say InProc then it will be stored in the processor memory. Typically you can say it will be stored on asp.net_wp.exe.
The stateserver will be stored on the memory but it can be remote and multiple application can share same.
The sqlserver state mode will maintain the state of the session. The framework has the scripts which allows you to set up this mode.
Jignesh TrivediPosted Mar 5, 2012, 7:11 AM
to store in session variable use,
Satyapriya NayakPosted Mar 5, 2012, 7:08 AM
Sessions can be used to store even complex data for the user just like cookies. Actually, sessions will use cookies to store the data, unless you explicitly tell it not to. Sessions can be used easily in ASP.NET with the Session object.
Ex:-
<%@ Page Language="C#" %>
<%@ Page Language="C#" %>
Thanks
If this post helps you mark it as answer