Reject (Hard 404) ASP.NET MVC-style URLs
        Posted  
        
            by James D
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by James D
        
        
        
        Published on 2010-03-26T15:07:31Z
        Indexed on 
            2010/03/26
            15:53 UTC
        
        
        Read the original article
        Hit count: 316
        
Hi,
ASP.NET MVC web app that exposes "friendly" URLs:
http://somesite.com/friendlyurl
...which are rewritten (not redirected) to ASP.NET MVC-style URLs under the hood:
http://somesite.com/Controller/Action
The user never actually sees any ASP.NET MVC style URLS. If he requests one, we hard 404 it. ASP.NET MVC is (in this app) an implementation detail, not a fundamental interface.
My question: how do you examine an arbitrary incoming URL and determine whether or not that URL matches a defined ASP.NET MVC path?
For extra credit: how do you do it from inside an ASP.NET-style IHttpModule, where you're getting invoked upstream from the ASP.NET MVC runtime?
Thanks!
© Stack Overflow or respective owner