採用網域認證可免建立獨立帳號系統、達成單一登入 (SSO)、提升安全性。本文說明 IIS 設定與 Web.config URL 授權規則。
優點:設定檔部署隨應用程式走,免逐目錄設定 NTFS 權限。
\root\ (所有合法網域用戶)
\root\admin\ (僅管理員群組)
\root\sales\ (業務群組)
\root\user\ (一般用戶)
<configuration>
<system.web>
<authentication mode="Windows" />
<identity impersonate="true" />
<authorization>
<allow roles="Domain\Users, Domain\Admins" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
<configuration>
<system.web>
<authorization>
<allow roles="Domain\Admins" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
<identity impersonate="true" />:以呼叫者身分執行程式碼,後端資料庫連線可用 Windows 整合驗證。<allow roles="..."/> 支援網域群組 (格式 Domain\Group) 與個別帳號。<deny users="*"/> 封鎖其餘所有人。Integrated Security=SSPI 搭配應用程式集區身分。