0
我使用asp.net xss脚本工作。一页发送帖子,比得到一个cookie。 在头文件中,我读取cookie返回,但浏览器没有设置它。 这样的document.cookie是空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的设置好的?
不,我写了http:// localhost,只是我在这里犯了一个错误 – user1693057