4
votes

I am currently developing in Umbraco 4.7.

My client has a requirement to redirect classic ASP pages with the .asp extension to their new pages. I have installed the following package:

Manage URL Redirects http://our.umbraco.org/projects/backoffice-extensions/manage-url-redirects

This packages does exactly what I need with .aspx pages and for those without an extension.

However, when it comes to .asp this doesn't work. My first thoughts are that this is because .asp is not set up to map to .aspx pages within the handler mappings configuration within IIS7.

In an attempt to resolve this, I have added a new handler mapping to IIS.

  1. Add Script Manager
  2. Request Path - *.asp
  3. Executable - C:\windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
  4. Name - ClassicAspToNet

Prior to adding this handler mapping, I was receiving the IIS 404 error page. Now I receive a Server Exception:

Failed to Execute URL.

Example: * REMOVED LINK HERE *

Your help would be greatly appreciated in helping me determine whether it is possible to serve .aspx pages with a .asp extension, and if so, how do I do this?

Thanks in advance,

David.

3
I get a 404 on that url for what its worth. And it certainly is possible to run .asp files through the .aspx engine. If you create a normal .asp page (that is a asp.net file) does it work? - Chris
Why not just use IIS URL Rewriting to redirect (not rewrite, despite the name) .asp URLs to their .aspx equivalents? (of course, URIs should not reveal implementation details like file extensions... Just saying) - Dai
Sorry Chris, I was playing with this site. I have put it back to show the error. - David Muir
David, I whole heartedly agree on the file extensions. The site I have developed doesn't use the extensions, but this is for the redirects from their old URLs to the new ones so it's something that's outwith my control - David Muir
Classic or integrated pipeline? - AnthonyWJones

3 Answers

0
votes

I had a similar issue with a PHP to Umbraco migration. My solution was to add an extensionless handler (wildcard mapping) and then use the UrlRewriting in Umbraco to strip the .php and replace it with .aspx.

Here's the rewrite rule I used:

<add name="phptoaspx"
     virtualUrl="^~/(.*).php"
     rewriteUrlParameter="ExcludeFromClientQueryString"
     destinationUrl="/$1.aspx"
     ignoreCase="true" />  

Perhaps in your case you just need the rewrite? You may need to remove the .asp from the IIS handler mappings though.

0
votes

You can try the blog entry I wrote about how to remap other extensions to IIS in both Classic Mode and Integrated mode: http://blogs.msdn.com/b/carlosag/archive/2008/07/04/mappingfileextensionforaspxpagesiniis70.aspx

0
votes

You can use the 301 Moved Permanently feature in case if that helps.

In you classic asp site you have global.asa with event like On Application start, you can redirect to the the appropriate aspx file.

e.g

Sub Application_OnStart
    Declare a variable and Get page name from request and redirect accordingly

   Response.Status="301 Moved Permanently"
   Response.AddHeader "Location","http://www.example.com/" + VariableNameThatHoldsPageName
   Response.End

End Sub

Hope it helps.....