IIS Form 认证 保护HTML页面

原来是没注册 HttpHandler,还有需要提供 buildProviders,

1、在 Web.config 中设置,在 <system.web> 下的 <httpHandlers> 中增加一行
<add verb="*" path="*.htm" type="System.Web.UI.PageHandlerFactory"/>
2、然后在 <system.web> 下的 <compilation> 下添加
<buildProviders>
  <add extension=".htm" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
这下就可以了。

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings/>
<system.web>
<customErrors mode="Off"/>

<globalization requestEncoding="gb2312" responseEncoding="gb2312" />
<compilation debug="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<add extension=".htm" type="System.Web.Compilation.PageBuildProvider"/>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
</compilation>

<authentication mode="Forms">
<forms name="CCIC.COOK"
loginUrl
="UserBox/login.aspx"
protection
="All"
path
="/"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>

<pages validateRequest="false" />

<httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="102400" executionTimeout="900"/>
<httpModules>
<add name="WebbHttpModule" type="Cms.FileUpload.WebbHttpModule, Cms.FileUpload"/>
</httpModules>
<httpHandlers>
<add verb="*" path="progress.ashx" type="Cms.FileUpload.WebbUploadStatusHandler, Cms.FileUpload"/>
<add verb="*" path="*.htm" type="System.Web.UI.PageHandlerFactory"/>
<add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
</system.web>

<location path="_ygtd">
<system.web>
<authorization>
<allow roles="szsfgs"/>
<deny users="*"/>
</authorization>
</system.web>
</location>


</configuration>

posted @ 2011-03-24 13:20  玛雅人  阅读(983)  评论(0编辑  收藏  举报