我为系统管理员设置了一个登陆页面,想达到必须通过身份验证才能进入管理员/用户页面的目的。但通过输入管理页面的路径就能进去。
我在Web.config中设置了这样的节:
<location path = "admin.aspx">
<system.web>
<authorization>
<deny users = "?" />
</authorization>
</system.web>
</location>但设置之后,即使帐号密码对了也进不去,这是什么 原因?
还有其他方法没?

解决方案 »

  1.   

    还要设置authentication,
    这样如果从其它页面进去的话就会被引导到 login.aspx 页面
    <authentication mode="Forms">
            <forms loginUrl="login.aspx"  name=".ASPXFORMSAUTH">
            <credentials passwordFormat="Clear">
            <user name="admin" password="ISMvKXpXpadDiUoOSoAfww=="/>
            </credentials> 
            </forms> 
    </authentication>
      

  2.   

    在Web.Config文件中设置:<authentication mode="Forms">              
        <forms name=".ASPXUSERDEMO" loginUrl="Login.aspx" protection="All" timeout="30"/>
    </authentication>
    <authorization>
        <deny users="?"/>
    </authorization>
      

  3.   

    <system.web>
    <compilation defaultLanguage="vb" debug="true" />
    <authentication mode="Forms">
    <forms name="MYWEBAPP.ASPXAUTH"
       loginUrl="err.aspx"
       protection="All"
       path="/"/>
       </authentication>
       <authorization>
    <allow users="*"/>
       </authorization>
      </system.web>
     <location path="admin">
    <system.web>
      <authorization>
     <allow roles="admin"/>
     <deny users="*"/>
                   </authorization>
    </system.web>
      </location>这是我写的一个正在用的,根目录下所有人都能访问,admin目录下的只能通过角色验证为admin的才能访问