How do I use AJAX to GET info from server without

2019-06-26 06:14发布

问题:

I would like to make a periodic background request from JavaScript on the client to my web application (ASP.NET, IIS 7), but I don't want the request to affect the ASP.NET session timeout.

Is there a way to do this?

回答1:

You have to avoid sending cookies with your request because that's how session ids are transmitted.

If you have an xmlHTTPRequest object, you can remove your cookie header by calling xmlHTTPRequest.setRequestHeader("Cookie", "");