Web.Config 組態檔案結構
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/><!--應用程式參數設定-->
<connectionStrings/> <!--資料庫連線設定-->
<system.web>
<compilation debug="false"/>
<authentication mode="Windows"/> <!--驗證模式-->
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"><!--系統管理者自訂錯誤模式-->
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
</system.web>
</configuration>
基本表單驗證
<configuration>
<system.web>
<authentication mode="[Windows/Forms/Passport/None]">
</authentication>
</system.web>
</configuration>表單驗證及權限
<configuration>
<system.web>
<authentication mode="Forms"/>
<forms name="login"loginUrl="login.aspx" />
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>表單驗證含帳號密碼
<system.web>
<authentication mode="Forms">
<forms loginUrl="login.aspx">
<credentialspasswordFormat="Clear">
<user name="Joydip"password="Joydip" />
</credentials>
</forms>
</authentication>
<authorization>
</system.web>
</configuration>
表單驗證採WINDOWS系統驗證
<authentication mode="Windows"/>
<authorization>
<allow users ="*" />
</authorization>
參考資料來源:http://aspalliance.com/907_Authentication_and_Authorization_in_ASPNET