Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the extension that .Net pages will run under?

I need my .net application to use the .html extension instead of .aspx

I'm converting a php app and there are external applications which depend on that extension to function.

What is the best way to do this?

Thanks

like image 707
NotMe Avatar asked Oct 27 '08 15:10

NotMe


1 Answers

In IIS, when you create the application for the virtual directory, click on "Configuration" for the application, and edit "App mappings", i.e. add a new mapping for html.

Or, in your web.config, in add this sections:

<httpHandlers>
   <remove verb="*" path="*.html" />
   <add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory" />
</httpHandlers>
<compilation>
   <buildProviders>
       <buildProvider 
           extension=".html" 
           type="System.Web.Compilation.PageBuildProvider" />
   </buildProviders>
</compilation>

EDIT: Added the section, according to the comment. Thanks Chris.

like image 150
Sunny Milenov Avatar answered Sep 30 '22 12:09

Sunny Milenov