I have been tasked with re-writing an old website written in classic asp and the client has specified that the page URL structure remain the same as the old site (I know I could add 301 redirects but they want it to look the same for now).
The old '.asp' pages will not exist on the server and it will not be running classic asp at all, the new site is built using MVC 5, it just needs the old URLs.
I have created a route to map pages for a specific 'Web Pages' controller to look like they have the '.asp' file extension as below, and this seems to work fine locally (IIS7).
My route is defined as:
routes.MapRoute(
"WebPagesASP",
"pages/{pagename}.asp",
new { controller = "WebPages", action = "Details", pagename = UrlParameter.Optional }
);
Once published to an Azure website however, I get the following error when attempting to view the 'asp' pages. The other routes with no file extension work fine, I also have some routes to other specific file extensions which work as expected.
You do not have permission to view this directory or page.
I have tried adding the following to the configuration to attempt to catch requests for asp files:
<system.webServer>
<handlers>
<add name="OldASPUrlRoutingHandler" type="System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="*.asp" verb="GET"/>
</handlers>
<modules>
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
</system.webServer>
Also setting <modules runAllManagedModulesForAllRequests="true">
does not solve the issue. Again this all works fine locally, but fails when published to an Azure website.
The site is built in MVC 5.1.1 on .Net 4.5.1