【发布时间】:2013-06-30 16:37:21
【问题描述】:
我使用 asp.net xss 脚本。一页发送一个帖子,而不是得到一个cookie。 在标题中,我读取了 cookie 返回,但浏览器没有设置它。 所以 document.cookie 为空
标题:
Set-Cookie:token=12ccc584-9f14-4c07-bbd9-0deba07b2a8e; expires=Fri, 30-Aug-2013 16:33:53 GMT; path=/
我在后端允许这些标头:
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin",
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", localost");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Credentials", "true");
$.ajax(
{
url: "http://localhost:49670/api/authentication",
type:"post",
data: loginDTO,
success: function() {
console.log("works");
console.log("cookies: ", document.cookie);
},
error: function(request, status, error){
console.error(request.responseText);
},
xhrFields: {
withCredentials: true
}
});
为什么没有设置 cookie?
【问题讨论】:
标签: php javascript jquery asp.net xss