开发者

session.sessionid in asp.net?

开发者 https://www.devze.com 2022-12-24 09:15 出处:网络
i have a doubt in sessionid. when user visit the site one sessionid will maintain until he close the开发者_如何学Python website or login, the sessionid will remain same or not is sessionid will change

i have a doubt in sessionid. when user visit the site one sessionid will maintain until he close the开发者_如何学Python website or login, the sessionid will remain same or not is sessionid will change for every request?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消