Q: Why is session occasionally lost on some machines?
A: May be related to the environment of the machine, such as: Firewall or anti-virus software, etc., try to shut down the firewall.
Q: Why did the Session_End method not fire when calling Session.Abandon?
A: First, the Session_End method only supports session InProc (in-process) types. Second, to fire the Session_End method, the session must exist (that is, the session is already in use in the system), and at least one request will be completed (the method is called in this request).
Q: Why is it often lost when I use the session in InProc mode?
A: This problem is usually caused by an application being reclaimed, because when you use an in-process session, the session is saved in the aspnet_wp process, and when that process is recycled, it's not there. Determines whether the process is recycled and can obtain information by viewing the system's Event Viewer.
For specific information please refer to:
Session variables are lost intermittently in asp.net applications
http://support.microsoft.com/default.aspx?scid=kb;en-us; Q316148
A bug at 1.0 also causes the worker process to be reclaimed and restarted, and the bug has been fixed in 1.1 and SP2.
For more information on this bug, please refer to:
asp.net Worker Process (aspnet_wp.exe) is recycled unexpectedly.
http://support.microsoft.com/default.aspx?scid=kb;en-us; Q321792
Q: Why is the ID of the new session the same as the original after the session timed out or abandoned?
A: Because SessionID is stored in the client browser instance, when the session timeout in the server to re-establish session, will use the browser from the SessionID, so when the session times out, and then re-establish after the SessionID unchanged.
Q: Why is the sessionid of each request different?
A: The problem may not be caused by saving any information in the session, that is, no session is used anywhere in the program. SessionID will always be relevant to the browser when the information is saved in the session, and the SessionID will not change at this time.
Q: Can you share the session between ASP and asp.net?
Answer: Yes. But this is a more complicated process, Microsoft has provided the official solution, please refer to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ Converttoaspnet.asp
Q: What type of object can be saved in the session?
A: This relies on the use of Session mode, which is used in-process (INPROC) sessions so that you can easily save any objects. If you use a inproc pattern, you can only save objects that are serializable and deserialized, and you cannot save to a session in this mode (not InProc) if the object you are saving is not serializable.
Q: Why can't I jump the page using the Response.Redirect and Server.Transfer methods in Session_End?
A: Session_End is an event-handling function that fires inside the server. It is based on a timer within a server, and there is no associated HttpRequest object on the server when the event is fired, so the Response.Redirect and Server.Transfer methods are not available at this time.
Q: Can I get HttpContext objects in the Session_End?
A: No, because this event is not associated with any requests (request), and there is no context based on the request.
Q: How do I use the session in a Web service?
A: To use session in a Web service, you need to do some extra work with the caller of the Web service, and you must save and store the cookies that are used when calling the Web service. Please refer to the Httpwebclientprotocol.cookiecontainer properties of the MSDN documentation for more information. However, if you use a proxy server to access the Web service because of the limitations of the framework, neither session can be shared.