我想在我的网站上使用自定义扩展程序。 我的意思是,我不想使用“default.aspx”,我想使用“default.customext”
我怎么能在web.config或其他任何地方这样做?
ps:我没有机会改变IIS上的asp.net配置
我使用的是.NET Framework 3.5,Visual Studio 2008 sp1,目标服务器是IIS 7
谢谢
答案 0 :(得分:9)
如果您在IIS7集成模式(我建议使用)上运行,那么您很高兴。只需将customext
映射到Web.config的PageHandlerFactory
部分中的<system.webServer>
。
<system.webServer>
<handlers>
<add name="CustomExtensionHandler"
path="*.customext"
verb="*"
type="System.Web.UI.PageHandlerFactory"
preCondition="integratedMode" />
</handlers>
</system.webServer>
IIS7经典模式。类似的东西:
<system.web>
<httpHandlers>
<add path="*.customext"
verb="*"
type="System.Web.UI.PageHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="CustomExtensionISAPI"
path="*.customext"
verb="*"
modules="IsapiModule"
scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
</handlers>
</system.webServer>
答案 1 :(得分:1)
在IIS6中查看此StackOverflow问题:ASP.NET - IIS Custom Mapping Extensions - How?
答案 2 :(得分:0)
答案 3 :(得分:0)
您可以在Helicon Ape mod-rewrite中使用以下配置:
RewriteBase /
RewriteRule ^ default.customext $ default.aspx [NC,L]