what is the default expiration time of a cookie

前端 未结 2 539
孤城傲影
孤城傲影 2021-01-07 16:13

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

    HttpCookie myCookie= new HttpCookie(\"myCookie\");
    myCookie.Value = txtC         


        
2条回答
  •  生来不讨喜
    2021-01-07 16:34

    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

提交回复
热议问题