Forms Authentication 再紀錄

MVC5, FormsAuthentication 再紀錄。

需求

  1. SSO登入。

  2. 登入後更換Session。

  3. 使用Forms Authentication

  4. 登出後更換Session。

設定Web.Config驗證模式為:Forms

Weg.config
<configuration>
  <system.web>
    <authentication mode="Forms">
      <forms loginUrl="~/Home/Index" timeout="30" requireSSL="true" />
      <!-- timeout 預設:30分鐘; 2880分鐘 = 2天; 8640分鐘 = 6天 --> 
      <!-- requireSSL,預設:false; 上線再設為true,開發期設為false --> 
    </authentication>  
  </system.web>
</configuration>

程式碼紀錄登入與登出

Last updated