I'am trying uderstand how "Session_Start" in Global.Asax works. Let's say I've got few pages on my website. For example: I'am entering on "Page A", then function "Session_Start" is firing. Then I'am going to "Page B", and what than ?. Function will firing again, or not ?. I'am trying to write code which will check that cookie "User" exist, and if exist, code will return Session["userName"] variable, but I'am not sure is "Session_Start" good place for that..
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- Chrome not keeping my _SESSION vars when coming fr
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- entity type has no key defined - Code first
If you want to make session unlimited, you can use cookies. Which I think you are using, you mentioned that in your original query.
Session_End is fired when user logs out, closes browser to end the session or session times out.
You can keep the cookie on user's browser. And check the cookie in Session_Start for valid values. And resume the session for the user.
You can also increase the session timeout from server configuration.
No it will not fire again, for second page. Session_Start fires the first time when a user's session is started
You can use this to check user cookie and save the result to session variable to access in further pages.