成功验证后,我在响应标题中输入 _SessionId 值( Set-Cookie :ASP.NET_SessionId = 02jsm1y515st1at34tnym1uu; path = /; HttpOnly)。< / p>
我需要存储此值以将其发送回任何其他请求。
有什么想法。
注意:我正在使用CORS
void Application_BeginRequest(object sender, EventArgs e){
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin" , "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}
login(value: any) {
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
let params = new URLSearchParams();
params.set('module', 'login');
params.set('user', (value.email).toString());
params.set('pass', (value.password).toString());
return this.http.get(this.loginUri, {
search: params
})
.map(res => {
console.log("===++" + res.text());
console.log("=====" + res.text().replace(/([a-z][^:]*)(?=\s*:)/g, '"$1"'));
return JSON.parse(res.text().replace(/([a-z][^:]*)(?=\s*:)/g, '"$1"'));
})
.catch(this.handleError)
}