从XMLHtt prequest对象删除的cookie [英] Remove cookie from XMLHttpRequest object

查看:163
本文介绍了从XMLHtt prequest对象删除的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个Ajax调用使用jQuery这样的:

I am making an ajax call with jquery like:

$.ajax({
    url: "path/to/webservice.asmx"
    beforeSend: function(xmlHTTPRequest) {
        //modify headers here
        //remove cookies
    }
    success: function() {
        //do stuff 
   }
}

我想这样做的beforeSend功能是采取设置来电xmlHTT prequest变量并修改标题删除cookie的对象,它是在那里,所以在调用我的web服务,它不能在asp.net续约窗体身份验证

What I would like to do in the beforeSend function is take the incoming xmlHTTPRequest variable that is set and modify the headers to remove the cookie object that is in there, so in the call to my web service, it does not renew forms authentication in asp.net

推荐答案

尝试

xmlHTTPRequest.setRequestHeader("Cookie", "");

编辑:看来这是不行的,至少不会一致。阅读饼干怪兽对于XMLHtt prequest

It appears this does not work, at least not consistently. Read Cookie Monster For XMLHttpRequest

您也可以使用的jQuery插件的cookie 删除Cookie。

You could also use the jQuery cookie plugin to delete cookies.

$.cookie("nameOfCookie", null);

这篇关于从XMLHtt prequest对象删除的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆