让未验证的导向到SignIn.aspx?不是很明白你的意思。举个例子给你,看看是不是你需要的效果。
有Login.aspx登录页面,进入网站的任何人到首先看到此页面。通过验证的可以进入其他页面,未注册的用户不允许进入其他页面,但允许其进入注册页面Reg.aspx进行注册。
(1)在iis中将该程序设置为允许匿名访问;//表明iis不负责身份验证,将此工作交给程序
(2)在WebConfig中如下设置:
<authentication mode="Forms">
<form loginUrl="Login.aspx" /> 表示进入程序首先进入的页
</authentication><authorization>
<deny users="?" /> 表示拒绝匿名用户
</authorization><location path="Reg.aspx">
<system.web>
<authorization>
<allow users="*"> 表示允许任何人访问注册页
</authorization>
</system.web>
</location>
有Login.aspx登录页面,进入网站的任何人到首先看到此页面。通过验证的可以进入其他页面,未注册的用户不允许进入其他页面,但允许其进入注册页面Reg.aspx进行注册。
(1)在iis中将该程序设置为允许匿名访问;//表明iis不负责身份验证,将此工作交给程序
(2)在WebConfig中如下设置:
<authentication mode="Forms">
<form loginUrl="Login.aspx" /> 表示进入程序首先进入的页
</authentication><authorization>
<deny users="?" /> 表示拒绝匿名用户
</authorization><location path="Reg.aspx">
<system.web>
<authorization>
<allow users="*"> 表示允许任何人访问注册页
</authorization>
</system.web>
</location>
string HashTicket = FormsAuthentication.Encrypt (Ticket) ;
HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket) ;
Context.Response.Cookies.Add (UserCookie) ;
<configuration> <system.web>
<authentication mode="Forms">
<forms
name = "PetShopAuth"
loginUrl="SignIn.aspx"/>
</authentication> //意思是未验证的网页自动转向"signin.aspx"
/> </system.web> //注意<location>不要写在上一对<system.web>中了
//这表示你要让以上规则应用的作用范围,可以是文件,也可以是一个子目录。就是说你可以在访问这个网页或目录时,要求未通过验证的用户自动转向。 <location
path="page2.aspx(或所在目录)">
<system.web>
<authorization>
<deny users="?"/> //这一段是授权意思是拒绝匿名用户访问
</authorization>
</system.web>
</location> </configuration>