Hello Everyone,
I am saving Session values in cookies with following code :
- HttpCookie AlvloginCookie = new HttpCookie("AlvLogin");
- //Set the Cookie value.
- AlvloginCookie.Values["Name"] = Session["Name"].ToString();
- AlvloginCookie.Values["UserAuthKey"] = Session["UserAuthKey"].ToString();
- AlvloginCookie.Values["Email"] = Session["Email"].ToString();
- AlvloginCookie.Values["UserId"] = Session["UserId"].ToString();
- AlvloginCookie.Path = Request.ApplicationPath;
- AlvloginCookie.Expires = DateTime.Now.AddDays(365);
- Response.SetCookie(AlvloginCookie);
- Response.Cookies.Add(AlvloginCookie);
Using that cookies on page using following code :
Request.Cookies["UserId"].Value;
The cookies are getting created in browser, but it does not last long for 365 days.
It is getting expired after couple fo hours.
Anything I missed or any other suggestion would be really appreciated
Thank you in advance
Santhakumar MunuswamyPosted Aug 15, 2020, 10:16 PM
Guest UserPosted Aug 15, 2020, 1:48 PM
Laxmidhar SahooPosted Aug 15, 2020, 3:22 AM
Navaneeth KrishnanPosted Aug 15, 2020, 12:17 AM
Farhan AhmedPosted Aug 14, 2020, 12:50 PM
Darshan ShahPosted Aug 14, 2020, 11:17 AM