The following method used to set last session id to the new request. we can use the following mehtod to maintain the same session for a user with cross browser request or request from different locations ( different IP).
public void SetLastSession(string LastSessionId)
{
HttpCookie cookie =
new HttpCookie("ASP.NET_SessionId", LastSessionId) { Path = "/", HttpOnly = true };
this.Context.Response.Cookies.Remove("ASP.NET_SessionId");
this.Context.Response.Cookies.Add(cookie);
}
public void SetLastSession(string LastSessionId)
{
HttpCookie cookie =
new HttpCookie("ASP.NET_SessionId", LastSessionId) { Path = "/", HttpOnly = true };
this.Context.Response.Cookies.Remove("ASP.NET_SessionId");
this.Context.Response.Cookies.Add(cookie);
}
Comments
Post a Comment