We are replacing an old classic asp website with a .NET 3.5 solution.
We need to redirect all of the classic ASP requests to aspx pages (i.e. contactus.asp, may now route to /contact-us/default.aspx). What I woudl like is for the requests to hit global.asax so I can do something like
If url == "bob.asp"
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", SiteConfig.SiteURL + redirectUrl);
End If
There are two inelegant solutions.
A) Place a global.asa file and do the routing through that.
B) Map asp files to the .NET engine. Great, but then if we need to host classic asp sites on our sites IIS will be sending the requests to the wrong place.
I found a nice solution here
http://forums.asp.net/p/1202225/3458901.aspx
Which stated something like this may work...
<buildProviders>
<add extension=".php" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
<httpHandlers>
<add verb="*" path="*.php" type="System.Web.UI.PageHandlerFactory" validate="True" />
</httpHandlers>
This example was for php but I assume the same thing would work for asp. However after changing .php to .asp in the example and placing the tags in the correct part of the web.config I'm having no joy (a 500 server error actually).
Can anyone shed any light on this or give me an elegant solution.
Had a feeling the above solution wouldnt work for php or asp as IIS will have routed the request before it gets to the .NET engine.
Thanks in advance
Steve