Routing classic ASP with ASP.NET webforms

92 views Asked by At

Before starting, I see many answers for MVC but I'm not using MVC.

I just want this but for WebForms, not MVC.

For a hybrid Classic ASP/ASP.NET WebForms project, I'm trying to setup simple routing rules with RouteTable.Routes.MapPageRoute in global.asax, like this:

Protected Sub Application_Start()
   '...
   RouteTable.Routes.MapPageRoute("Projects", "friendly_link", "~/ugly/internal/stuff.asp")
   '...
End Sub

I'm not even trying to map parameters, just simple redirections because I want to avoid having a large URL rewrite section in web.config. Setting the above up gives me this:

There is no build provider registered for the extension '.asp'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

However, as I understand it, that would be processing via ASP.NET which I don't want, I want it processed by classic asp.dll.

I tried setting up the handler in web.config thus:

<system.webServer>
  <handlers>
    <remove name="ASPClassic" />
    <add name="ASPClassic" preCondition="integratedMode" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" resourceType="File" />

But that gives me a 404.2 "The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server."

So how do I route Classic ASP back to ASP.dll after having passed through global.asax?

0

There are 0 answers