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
}
}
What I would like to do in the beforeSend function is take the incoming xmlHTTPRequest variable tha开发者_如何学编程t 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
Try
xmlHTTPRequest.setRequestHeader("Cookie", "");
EDIT: It appears this does not work, at least not consistently. Read Cookie Monster For XMLHttpRequest
You could also use the jQuery cookie plugin to delete cookies.
$.cookie("nameOfCookie", null);
精彩评论