Configuring IIS To Server Up .cfm Extensions as .aspx Pages

Recently we needed to configure an IIS server to serve up a .cfm page as though it were a .aspx page. This was a page that was being accessed by a desktop program and the old link needed to still be good even though we did not want ColdFusion to be installed on the new server we were moving to. We first re-wrote the functionality into a new .aspx page and then replaced the original .cfm page with a simple .aspx page that included a server-side transfer to the new page.

There are several steps necessary to get your ASP.NET application to parse files with a .cfm extension as though they were .aspx files:

  1. Configure IIS to associate the .cfm extension with the aspnet_isapi.dll
  2. Configure the application (Web.config) to handle the requests as though they were .aspx pages
  3. Redirect the pages seamlessly

STEP 1 - Configure IIS

  • Open IIS Manager
  • Right click on your Web Site and click [Properties]
  • Select the [Home Directory] tab

 Figure1

  • Click on the [Configuration...] button
  • On the [Mappings] tab, click on the [Add] button
  • Browse to c:\Windows\Microsoft.Net\Framework\v2.0.xxxxx\aspnet_isapi.dll

 Figure2

  • (NOTE: if you are using IIS 5.1 there is a bug in the Browse functionality.  You must go back and click inside the [Executable] text box before the [OK] button will be enabled)
  • Type ".cfm" in the [Extension] text box
  • (Optionally set the other values here)
  • Click [OK]
  • Restart your web site

STEP 2 - Configure the application

After configuring IIS to recognize the .cfm extension, you need to configure you application via the Web.config file to use the right handling for the .cfm extension.  Here is an example of the elements you need to add.

 Figure3

STEP 3 - Create the redirect page

Now that IIS and your application are going to parse your .cfm file as an ASP.NET page, you can easily create a server-side redirect that will send the request to the new .aspx page that mimics the old .cfm functionality.  A very simple example follows.

Figure4

 

Conclusion

You can actually use this procedure for any custom extensions that you might want to use, however for practical usage it should be limited to scenarios where you really don't want the URL to change but you need to switch to a different parsing engine. 

  • Welcome  ›
  • Notes  ›
  • Configuring IIS To Server Up .cfm Extensions as .aspx Pages


Tuesday, January 29, 2008, maswaffer

Copyright 2007 Dynamic Dataworks LLC

Powered by umbraco