<authentication mode="Forms">
<forms name=".MyCookie" loginUrl="Manage/Error.htm" protection="All" timeout="30" path="/">
                    <!-- protection="[All|None|Encryption|Validation]" -->
      </forms>
</authentication><location path="Manage">
<system.web>
<authorization>
<allow users="超级管理员"/>
<deny users="*" />
</authorization>
</system.web>
</location>以上是我的Web.config的配置,我想保护Manage下的所有文件。可是在运用中发现,这个配置只能保护该目录下的aspx文件,对于asp,html,图片文件根本不保护,通过地址可以直接访问到。请教各位:是否可以通过Form验证实现保护该目录下的所有文件?先谢谢各位了。

解决方案 »

  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>
      

  2.   

    我的意思是:
    我想对非asp.net文件进行保护验证可以吗?
    就是对整个目录进行保护。
      

  3.   

    不可以,你必须把这些类型显示的映射到aspnet_isapi.dll扩展。