what is the default expiration time of a cookie

℡╲_俬逩灬. 提交于 2019-11-30 21:24:55

问题


By default what will be the expiration time of a cookie added using C# code?

    HttpCookie myCookie= new HttpCookie("myCookie");
    myCookie.Value = txtCookie.Text;       
    // Add the cookie.
    Response.Cookies.Add(myCookie);

回答1:


The default Expires value for a cookie is not a static time, but it creates a Session cookie. This will stay active until the user closes their browser/clears their cookies. You can override this as required.

From the linked page:

Setting the Expires property to MinValue makes this a session Cookie, which is its default value




回答2:


20 minutes.
In IIS, click on your website, and go to Session State. In the second box (Cookie Settings), you can change the time out(in minutes).



来源:https://stackoverflow.com/questions/19002254/what-is-the-default-expiration-time-of-a-cookie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!