asp.net 配置文件 form 驗證的設置

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      <authentication mode="Forms">
        <forms loginUrl="Modules/Admin/Login.aspx"  timeout="28" />
      </authentication>
    </system.web>
  <location path="Modules/Admin" allowOverride="false">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

1.路徑前面不能加“/”,"~",否則會實現不了這個功能。

2. FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

   方法對cooike進行加密,寫入cooike,默認cooike的key 是 .ASPXAUTH

posted @ 2012-03-22 17:16  無限遐想  阅读(251)  评论(0编辑  收藏  举报