1. For a summary of session loss problems, refer to here
2. When using session in Web servcie, you need to process the web method as follows:
[Webmethod (enablesession = True )]
Public Void Usingsession ()
{
Session [ " Name " ] = " Name " ;
}
If enablesession is not added= TrueThe session cannot be used in the Web service.
3. Here we will talk about how to use mode = "StateServer" to solve the session loss problem:
1) first enable the Asp.net state service in the Windows service. This service is set to start manually by default.
2) Make the following configuration in Web. config:
< System. Web >
<! -- Other configuration information -->
< Sessionstate Timeout = "200000" Cookieless = "False" Mode = "StateServer" > </ Sessionstate >
</ System. Web >
Set timeout as needed. The key is to configure the cookieless attributes.= "False"Mode= "StateServer", cookieless defaults to false, so this attribute can be removed.
If cookieless is set to true, the URL contains the session ID, for example, http: // localhost: 4555/website/(S (dmb2qpn4m2x3cj55pzwcvh55)/index.html. In this case, the Web service will not be able to use the session normally.