I want to use custom extension on my web site. I mean, I do not want to use "default.aspx", i want to use "default.customext"
我想在我的网站上使用自定义扩展程序。我的意思是,我不想使用“default.aspx”,我想使用“default.customext”
How could i do this in web.config or anywhere else?
我怎么能在web.config或其他地方这样做?
ps: I have no chance to change the asp.net configuration on IIS
ps:我没有机会在IIS上更改asp.net配置
I am using .NET Framework 3.5, Visual Studio 2008 sp1, and target Server is IIS 7
我使用的是.NET Framework 3.5,Visual Studio 2008 sp1,目标服务器是IIS 7
thank you
4 个解决方案
#1
If you're running on IIS7 integrated mode (which I suggest using), you're good to go. Just map the customext
to PageHandlerFactory
in <system.webServer>
section of Web.config.
如果您在IIS7集成模式(我建议使用)上运行,那么你很高兴。只需将客户文本映射到Web.config的
<system.webServer>
<handlers>
<add name="CustomExtensionHandler"
path="*.customext"
verb="*"
type="System.Web.UI.PageHandlerFactory"
preCondition="integratedMode" />
</handlers>
</system.webServer>
IIS7 Classic Mode. Something like:
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>
#2
Take a look at this * question for doing this in IIS6: ASP.NET - IIS Custom Mapping Extensions - How?
在IIS6中查看此*问题:ASP.NET - IIS自定义映射扩展 - 如何?
#3
if you can get isapi rewrite installed you can 'rewrite' your pages.
如果您可以安装isapi重写,您可以“重写”您的页面。
see here for details: http://www.isapirewrite.com/
有关详细信息,请参阅此处:http://www.isapirewrite.com/
Josh
#4
You may use the following config in Helicon Ape mod-rewrite:
您可以在Helicon Ape mod-rewrite中使用以下配置:
RewriteBase /
RewriteRule ^default.customext$ default.aspx [NC,L]
RewriteRule ^ default.customext $ default.aspx [NC,L]
#1
If you're running on IIS7 integrated mode (which I suggest using), you're good to go. Just map the customext
to PageHandlerFactory
in <system.webServer>
section of Web.config.
如果您在IIS7集成模式(我建议使用)上运行,那么你很高兴。只需将客户文本映射到Web.config的
<system.webServer>
<handlers>
<add name="CustomExtensionHandler"
path="*.customext"
verb="*"
type="System.Web.UI.PageHandlerFactory"
preCondition="integratedMode" />
</handlers>
</system.webServer>
IIS7 Classic Mode. Something like:
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>
#2
Take a look at this * question for doing this in IIS6: ASP.NET - IIS Custom Mapping Extensions - How?
在IIS6中查看此*问题:ASP.NET - IIS自定义映射扩展 - 如何?
#3
if you can get isapi rewrite installed you can 'rewrite' your pages.
如果您可以安装isapi重写,您可以“重写”您的页面。
see here for details: http://www.isapirewrite.com/
有关详细信息,请参阅此处:http://www.isapirewrite.com/
Josh
#4
You may use the following config in Helicon Ape mod-rewrite:
您可以在Helicon Ape mod-rewrite中使用以下配置:
RewriteBase /
RewriteRule ^default.customext$ default.aspx [NC,L]
RewriteRule ^ default.customext $ default.aspx [NC,L]