我将根目录设定为不允许匿名登录,
想将管理目录设为不允许非admin登录.
现在的问题是:
我的admin登录页是loginAdmin.aspx
一般用户登录页是login.aspx
(因为是不同的表)
要达到这个效果,如何做呢?

解决方案 »

  1.   

    config---------------><authentication mode="Forms" > 
    <forms loginUrl="login.aspx"></forms>
    </authentication>
    <authorization>
    <deny users="?"/>
    </authorization>.CS----------------->string UserName=this.TextBox1.Text.Trim();
    FormsAuthentication.RedirectFromLoginPage(UserName,false);
    Response.Redirect("default.aspx?User="+this.TextBox1.Text.Trim());得到用户名----------》 User.Identity.Name注销----------------》FormsAuthentication.SignOut();设置不需要验证的页可以在config里这样写,如下面的NewUser.aspx页
    <location path="User/NewUser.aspx">
         <system.web>
            <authorization>
              <allow users="*"/>
            </authorization>
           </system.web>
     </location>