Welcome to YLOAN.COM
yloan.com » misc » Using Session State In Asp.net
Gadgets and Gizmos misc Design Bankruptcy Licenses performance choices memorabilia bargain carriage tour medical insurance data

Using Session State In Asp.net

ASP.NET is used for developing great websites using the .net framework

. While making websites, it is necessary to store session specific information such as name when user logs into account and displays name on the page. This helps in making website user interactive and customization based on user preference. Session state is an example of server side state management, which means that information is available at server side only, it can also be used to track the number of users logged in a website, number of visitors visited in day, month or year, traffic based on countries, number of clicks by a user and so on. This also helps in applications such as ads where the money has to be paid on the basis of number of clicks by a user.

The scope of session state is limited to the current browser session. If multiple users are accessing the website, each of them will have different session state. If a user exits from a website and logs back on, the user will have different session state. Session state is structured as a key-value pair for storing session specific information that needs to be maintained between server round trips and between requests for pages.

When a user first requests a page from an Asp.net website, website automatically adds a session cookie to the client browser. Each session is identified by a unique 20-bit session id string containing ASCII characters. Session state contains timeout attribute that means if the session is inactive for particular time period, it abandons the session. The default timeout is 20 minutes.

Storing and retrieving of a session:


We can store the session by using a variable

Session["name"]="Mitesh";

We can retrieve it from another page using

String value = (string) Session["name"];

Note that, we have to typecast because the session is stored as an object and it has to be retrieved in from of string.

Session state is global to the application for the current user. However, it can be lost in one of the following ways:

When Session.Abandon() method is called within web page code

When user closes and restarts the browser

When the user accesses the same web page through a different browser window

When the session times out because of inactivity

by: NeerajSwt
Easy Ways To Cure Tmj In A Week Naturally Different Methods For Fabric Dyeing All Of Your Spare Parts All In One Place. Chaussures Converse - Modification Des Ralisations Ceramic Charcoal Grills - Various Types Of Charcoal Grills Get Your German Documents Translated Using The Best German Translator Finding Long Lost Frat Buddies Cement Roller Mill Usable Cement Roller Mill Catahy Thinking About Reseller Opportunities? Read This! High Voltage Servomotor Driver For Electrical Control Plug Your Pension Shortfall Magic Remove Wrinkle Star - Retinol True Benefits As Well As Negatives Associated With Forex Robot
print
www.yloan.com guest:  register | login | search IP(216.73.217.98) California / Rosemead Processed in 0.017217 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 28 , 2369, 85,
Using Session State In Asp.net Rosemead