IIS7表单身份验证不会拒绝图像访问 [英] IIS7 Forms Authentication Doesn't Deny Image Access

查看:75
本文介绍了IIS7表单身份验证不会拒绝图像访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS7中建立了一个基本的ASP.NET网站,并在服务器上启用了表单身份验证.只是出于笑容,我否认所有人:

I have a basic ASP.NET website set up in IIS7 with forms authentication enabled on the server. Just for grins, I deny everyone:

<?xml version="1.0"?>
<configuration>
  <system.web>

    <authentication mode="Forms">
        <forms name=".ASPXAUTH" loginUrl="Login.aspx" defaultUrl="Test.aspx" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true"/>
    </authentication>

    <authorization>
        <deny users="*"/>
    </authorization>

    <compilation debug="true"/>
  </system.web>
</configuration>

当我访问default.aspx页面时,我忠实地重定向到Login.aspx页面.但是,我可以浏览到同一站点根目录下的.txt文件或.png文件,并且可以毫无挑战地显示它.

When I visit the default.aspx page, I get dutifully redirected to the Login.aspx page. However, I can browse to a .txt file or .png file on the root of the same site, and it displays it with no challenge.

这很奇怪,因为在Cassini开发服务器中,对这些文件的访问被阻止.仅当我发布到IIS7服务器时才会发生这种情况.

This is odd, because in the Cassini dev server, access to those files is blocked. This only occurs once I publish to my IIS7 server.

我肯定在IIS7中缺少某些东西,但是我一生都无法解决.

I must be missing something in IIS7, but I can't figure it out for the life of me.

  • 我在启用集成模式的.NET 4.0应用程序池中拥有该网站.
  • 在服务器上启用了表单身份验证
  • 在FormsAuthentication模块的编辑托管模块"弹出窗口上,我尝试取消选中仅为请求调用...",但是这样做时会抛出某种奇怪的错误(缺少某种形式的组合件?这是一个全新的服务器安装,没有多余的装饰,所以我无法想象这是怎么回事.

有人可以为此指出正确的方向吗?

Can anyone point me in the right direction on this?

谢谢! 刺绣

推荐答案

首先,您必须使用集成管道,然后将其添加到web.config中:

first of all you have to use integrated pipeline and then add this in your web.config:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="false">
    <remove name="FormsAuthenticationModule" />
    <add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />

    <remove name="UrlAuthorization" />
    <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
  </modules>
</system.webServer>

这篇关于IIS7表单身份验证不会拒绝图像访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆