I just wanted to clarify my understanding of ASP .NET MVC (current version is 4).
I was reading this article on How does ASP.NET MVC work?
So, how does ASP.NET know how to route requests to MVC? The answer lies in web.config. There is a new http module added to modules collection in ASP.NET MVC projects
So basically an mvc application is implemented as an HTTPModule or at least the url routing portion of an mvc app?
Would it be possible for one to create and register a custom routing module and then possibly create their own micro mvc framework like Sinatra in Ruby or Slim in PHP?
The Url routing is in fact it's own ASP.NET module. It's used both for MVC and WebForms (and can be used for other ASP.NET application types too). The routing is included in the System.Web
assembly. More info about the routing features can be found at MSDN.
MVC is implemented using a IHttpHandler. The implementation can be found here.
Now for the actual question:
Would it be possible for one to create and register a custom routing module and then possibly create their own micro mvc framework like Sinatra in Ruby or Slim in PHP?
Yes. It's fully possible. You need to create your own class that implements IRouteHandler. Then simply register routes using that handler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With