代碼
protected void Application_AuthenticateRequest(object SENDER
{
if (HttpContext
{
if (HttpContext
{
if (HttpContext
{
FormsIdentity id = (FormsIdentity)HttpContext
FormsAuthenticationTicket tiecket = id
string userData = tiecket
string[] roles = userData
HttpContext
}
}
}
}
登錄頁
<authentication mode=
<forms name=
</authentication>
配置目錄權限
代碼
<location path=
<system
<authorization>
<allow roles=
<deny users=
</authorization>
</system
</location>
<location path=
<system
<authorization>
<allow roles=
<deny users=
</authorization>
</system
</location>
<location path=
<system
<authorization>
<allow users=
</authorization>
</system
</location>
<location path=
<system
<authorization>
<allow users=
</authorization>
</system
</location>
代碼
HttpCookie cook;
string strReturnURL;
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
cook = new HttpCookie(
cook
Response
strReturnURL = Request
if (strReturnURL != null)
{
Response
}
else
{
Response
}
From:http://tw.wingwit.com/Article/program/net/201311/12711.html