I work with asp.net xss scripting. One page send a post, than got a cookie. In the header I read the cookie returns but the browser does not set it. so document.cookie is null
The header:
Set-Cookie:token=12ccc584-9f14-4c07-bbd9-0deba07b2a8e; expires=Fri, 30-Aug-2013 16:33:53 GMT; path=/
I allowed these headers at the backend:
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
}
});
Why was not the cookie setted?