如何使用AJAX来从服务器获取信息,无需重新设置会话超时?如何使用、服务器、信息、AJAX

2023-09-10 19:23:38 作者:占你心,做你王

我想打从JavaScript客户端上的周期性后台请求我的Web应用程序(ASP.NET,IIS 7),但我不希望影响到ASP.NET会话超时请求。

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?

推荐答案

您必须避免您的要求发送Cookie,因为这是多么会话ID传送。

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

如果你有一个xmlHTT prequest对象,你可以通过调用 xmlHTT prequest.setRequestHeader(曲奇,)删除您的cookie头;

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