How to change the extension on which .Net pages will work?

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

I am converting a php application, and there are external applications that depend on this extension to work.

What is the best way to do this?

thanks

+6
file-extension config
source share
4 answers

In IIS, when creating an application for a virtual directory, click "Configuration" for the application and edit the "Application mappings", i.e. add a new mapping for html.

Or, in your web.config, add the following 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 section, according to comment. Thanks to Chris.

+12
source share

Do you want to use httphandlers

+1
source share

Please note that I am not 100% sure that this will work with the PHP extension, we use this procedure for the user extension here.

You can change the IIS configuration: Open the IIS console (right-click My Computer> Manage ...> Services and Applications)

  • If you are on a website, open the website properties and the Home Directory tab.
  • If you are in a virtual directory, the tab "Virtual Directory" will appear in the properties.

Click the "Configuration" button, find the .aspx extension and use the same configuration for the ".php" extension (hint: you can copy the paste of the name of the executable DLL between both dialogs).

0
source share

Some time ago, we migrated a web application from coldfusion to PHP and had to keep the old URLs. The way we did this is to use mod_rewrite to rewrite .cfm URLs in .php. Perhaps you can do something like this?

0
source share

All Articles