I have used the ASP.net MVC Routing classes to provide REST-like URLs in a legacy ASP.net Web Application. Currently, the application has both these REST-like URLs, and file URLs (those ending in .aspx).
I now want to provide a facade over all these URLs for some additional functionality, something like http://server/facade/<actual url>
, for which I have a custom IRouteHandler. In my GetHttpHandler()
function, I need to return the handler for the <actual url>
. For example, given URLs like so (which invoke my IRouteHandler) :
http://server/facade/page.aspx
http://server/facade/dir/page2.aspx
http://server/facade/RESTy/url
http://server/facade/RESTy/path/arg
I need to return an IHttpHandler
to the following pages in the GetHttpHandler()
function:
http://server/page.aspx
http://server/dir/page2.aspx
http://server/RESTy/url
http://server/RESTy/path/arg
EDIT
Ok,
BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(Page)) as IHttpHandler
gets me an IHTTPHandler for file paths. Any way to get it for custom routes?