The default cookie name for the Session Id in ASP.NET is ASP.NET_SessionId
. It's also possible to change this name to something else like <sessionState cookieName="FooBar" />
.
Is there a member to easily access this name like with FormsAuthentication.FormsCookieName
?
Asp.net does it for you. So whenever you access Session dictionary your session will already be preserved if it existed from your previous request(s). If there is none (or expired) it will also be automatically created so adding items to it will make it work without a problem. var o = Session["SomeKey"];
Net_SessionId is a cookie which is used to identify the users session on the server.
By default, SessionID values are stored in a cookie. However, you can also configure the application to store the SessionID value in the URL for a "cookieless" session. We are developing a web application that has three pages.
Taking into account that you say that you set an different name for the cookie on the web.config then I'd say you could read the cookie name from there
SessionStateSection sessionStateSection = (System.Web.Configuration.SessionStateSection) ConfigurationManager.GetSection("system.web/sessionState"); string cookieName = sessionStateSection.CookieName;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With