Creating Understanding and Educating Programmers, Developers and Technical Communities, one post at a time.

Showing posts with label Session. Show all posts
Showing posts with label Session. Show all posts

Wednesday, September 30, 2009

Session Timeout

Session is always a most discussed topic in ASP.Net. Either you are beginner, intermediate or expert, you always play with them. If you don't know about the basic of session variable, please read my blog entry where I had wrote a very good quick and short tutorial on session variable (value assignment and retrieval).

Session Timeout is one of the most critical setting. It depends on the application requirement. You could set this property in Global.asax/Web.config. You can set session timeout in any one of them.

Web.config will use following setting. Look at the timeout attribute of sessionstate. You can set number of minutes. The default value is 20 minutes. You can set up to 1 year (525,600 minutes).

<configuration>
<system.web>
<sessionState cookieless="true" mode="InProc" timeout="1">
</sessionState>
</system.web>
</configuration>

Let me know, if blog entry about Session Timeout help you out to understand session concept. Your positive comments and questions are most welcome.

Friday, July 31, 2009

Session Vs Application Variable

Session Variables are those variable which only available to a single user. They are used to store/display single user information on website.

Application Variables are common to all user. These variables are used to configure application settings/other stuff.

Please read article, if you want to know more about Session.

Friday, May 29, 2009

[Quick Tip] Session

During the development of Asp.Net application, developer don't need to instantiate any session. Session is automatically instantiated, you need to use them according to your requirement. Here, I am going to show you one simple example.

DataTable dt = new DataTable();

// what ever the table you want to put in dt

// assign dt value into session variable, make sure it is unique name,
// I have given dtSessionVariable as session variable name.
Session["dtSessionVariable"] = dt;


// To retrieve it from session, it require casting back to original type
DataTable dt = (DataTable)Session["dtSessionVariable"];