The development environment IIS7 all normal, but after deployment to the IIS6 server, every time the page refreshes the AJAX client can not load the problem.
Copy Code code as follows:
protected void Application_acquirerequeststate (object sender, EventArgs e)
{
String oldtoken = session["token"]. ToString ();
}
MSDN says: application_acquirerequeststate, executed when ASP.net gets the current state (such as session) associated with the current request.
However, the reality is that when we use an AJAX control, a page triggers the event multiple times, and the session appears null.
The reason is that some scripts and pictures are parsed through WebResource.axd handler, but when a page uses multiple scripts and pictures, the page requests multiple times.
Has triggered this event many times.
Therefore, to access the session in an event, you need to first determine whether the session is null.
Alternatively, we first determine the type of request.
code as follows:
if (Request.Url.AbsoluteUri.Contains (". Axd") | | Request.Url.AbsoluteUri.Contains (". asmx"))
Return
Two days of pent-up, released, marked.