<authentication mode="Forms">
<forms name="auth" loginUrl="index.aspx" timeout="30"></forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
2: 如果有註冊頁面時還應該允許匿名用戶調用註冊頁面進行註冊;
以下代碼應該在<configuration><system.web>之間,而不應該包含到<system.web>..</system.web>之間;
----------------表示允許匿名用戶對 userReg.aspx頁面進行訪問.
<location path="userReg.aspx">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
3 在登錄成功後要創建身份驗證票, 表明已經通過認證的合法用戶;
if(登陸成功)
System.Web.Security.FormsAuthentication.SetAuthCookie(用戶名稱, false);