tags:

views:

186

answers:

4

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"

How could i do this in web.config or anywhere else?

ps: I have no chance to change the asp.net configuration on IIS

I am using .NET Framework 3.5, Visual Studio 2008 sp1, and target Server is IIS 7

thank you

+8  A: 

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.

<system.webServer>
    <handlers>
        <add name="CustomExtensionHandler" 
             path="*.customext" 
             verb="*" 
             type="System.Web.UI.PageHandlerFactory" 
             preCondition="integratedMode" />
    </handlers>
</system.webServer>

IIS7 Classic Mode. Something like:

<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>
Mehrdad Afshari
A: 

if you can get isapi rewrite installed you can 'rewrite' your pages.

see here for details: http://www.isapirewrite.com/

Josh

Josh
+1  A: 

Take a look at this StackOverflow question for doing this in IIS6: http://stackoverflow.com/questions/866104/asp-net-iis-custom-mapping-extensions-how

Dan
A: 

You may use the following config in Helicon Ape mod-rewrite:

RewriteBase /

RewriteRule ^default.customext$ default.aspx [NC,L]

TonyCool