3
Vote

Ignore/Stop Routing?

description

Trying to do this:
            var settings = new FriendlyUrlSettings
            {
                AutoRedirectMode = RedirectMode.Permanent,
            };
            routes.Add(new Route("handlerorpageorsomething.aspx/{*queryparams}", new StopRoutingHandler()));
            routes.EnableFriendlyUrls(settings);
Where routes are ignored form my custom page (due to a hard coded module using the specific handler URL.)

Is this even possible? Or does the Friendly URL enabled completely override all my routes?

comments

PatrickSmacchia wrote Aug 26, 2014 at 8:07 AM

Actually ignoring route cannot be composed with ASP.NET Friendly Urls that is internally based on HttpModule. Hence you need to derive from the ASP.NET Friendly Urls code and override the method that redirect path to make it no-op when you can match the path to avoid to redirect.

Here is the related code to make this work:

http://stackoverflow.com/a/25499902/27194