Asp.net 如何将服务器发送的会话_ID值存储到angular 2中的本地存储器中

Asp.net 如何将服务器发送的会话_ID值存储到angular 2中的本地存储器中,asp.net,angular,Asp.net,Angular,成功身份验证后,我在响应头中得到\u SessionId值(Set Cookie:ASP.NET\u SessionId=02jsm1y515st1at34tnym1u;path=/;HttpOnly) 我需要存储此值以在任何其他请求中发回 有什么想法吗 注意:我正在使用CORS Global.asax 角度2服务:获取方法 响应头是否将其自身(实际上是浏览器)保存到浏览器cookie中?我检查了我的cookie它是空的@HoBiIs控制台日志打印预期数据?通过向get方法添加withCrede

成功身份验证后,我在响应头中得到\u SessionId值(Set Cookie:ASP.NET\u SessionId=02jsm1y515st1at34tnym1u;path=/;HttpOnly)

我需要存储此值以在任何其他请求中发回

有什么想法吗

注意:我正在使用CORS

Global.asax 角度2服务:获取方法

响应头是否将其自身(实际上是浏览器)保存到浏览器cookie中?我检查了我的cookie它是空的@HoBiIs控制台日志打印预期数据?通过向get方法添加withCredentials:true解决了这一问题
返回this.http.get(this.KeyUri,{search:params,withCredentials:true}
响应头是否将其自身(实际上是浏览器)保存到浏览器cookie中?我检查了我的cookie它是空的@HoBiIs控制台日志打印预期数据?通过向get方法添加withCredentials:true解决了这一问题
返回this.http.get(this.KeyUri,{search:params,withCredentials:true}
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)


}