【发布时间】:2015-11-10 20:19:39
【问题描述】:
我正在尝试实现一个自定义 http 安全模块,该模块使用站点地图中的角色来控制对页面的访问(而不必将其全部存储在 web.config 中)。以下文章:http://www.codeproject.com/Articles/8728/Extending-ASP-NET-security
我已经为较新版本的 IIS 更新了它,而是在 system.webServer 中添加了模块
<system.webServer>
<modules>
<add name="SecurityHttpModule" type="DINO.SecurityHttpModule"/>
</modules>
</system.webServer>
在这方面似乎一切正常,但页面不再正确呈现。如果我在 Chrome 中查看控制台,我会看到类似
的错误Resource interpreted as Stylesheet (or Script) but transferred with MIME type test/html: "http://localhost:57855/login"
and
Uncaught SyntaxError: Unexpected token < (about the <!DOCTYPE html> at the top of the page)
我想我只是在添加自定义模块时遗漏了其他一些我需要做的事情,但我还没有找到任何关于这个问题的参考。
【问题讨论】:
-
该安全模块正在将该 CSS 请求重定向到登录页面。如果你解决了这个问题,你就会解决你的问题。您可能应该为特定资源文件夹或特定请求(匿名页面)向模块添加例外。我建议检查模块配置文档
标签: c# forms-authentication sitemap httpmodule