<authentication mode="Forms" >
<forms name=".name" protection="All" loginUrl="Login.aspx" defaultUrl="Default.aspx">
</forms>
</authentication>
<!--這是用戶授權節-->
<authorization >
<deny users="?"></deny>
<!--允許所有人登錄-->
<!--<allow users="*"/>--><!--允許所有人登錄-->
</authorization>
頁面中:
添加命名空間:using System.Web.Security;
通過驗證: FormsAuthentication.RedirectFromLoginPage("cookie中名字", false);
應用: Label1.Text = "歡迎"+User.Identity.Name+"來到保護頁"; //這時候:User.Identity.Name="cookie中名字“;