Surya sasidhar
Surya sasidhar

Reputation: 30293

session.sessionid in asp.net?

i have a doubt in sessionid. when user visit the site one sessionid will maintain until he close the website or login, the sessionid will remain same or not is sessionid will change for every request?

Upvotes: 0

Views: 807

Answers (2)

Anton Gogolev
Anton Gogolev

Reputation: 115691

MSDN page for SessionID has all you need:

The SessionID property is used to uniquely identify a browser with session data on the server. The SessionID value is randomly generated by ASP.NET and stored in a non-expiring session cookie in the browser. The SessionID value is then sent in a cookie with each request to the ASP.NET application.

When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application's Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object.

If your application uses cookieless session state, the session ID is generated on the first page view and is maintained for the entire session.

Upvotes: 3

pokrate
pokrate

Reputation: 3974

No it remains the same for 20 minutes (default setting in web.config ).

Upvotes: 0

Related Questions