cookie 跟 Request.IsAuthenticated 之间的关系

Request.IsAuthenticated是根据web.config中的cookie设置进行判断的,比如:

    <authentication mode="Forms">
      <forms name="cookieName" loginUrl="login.aspx" protection="All" timeout="43200" path="/" />
    </authentication>

使用Forms验证,登录后写cookie的代码很简单:

FormsAuthentication.SetAuthCookie(username, true);

这里的cookie设置也是由web.config中的设置决定的。

你可能感兴趣的:(cookie 跟 Request.IsAuthenticated 之间的关系)