how to increase session timeout in asp.net?

后端 未结 6 1704
感动是毒
感动是毒 2020-12-05 10:31

I tried following codes to increase session timeout, but no use,

code is:


<         


        
6条回答
  •  Happy的楠姐
    2020-12-05 11:33

    I wanted to add my final solution. After reading that setting it in the config was "incorrect".

                if (model.RememberMe)
                {
                    var ASPCookie = Request.Cookies["ASP.NET_SessionId"];
                    ASPCookie.Expires = DateTime.Now.AddDays(15);
                    Response.SetCookie(ASPCookie);
                }
    

提交回复
热议问题