Reputation: 105059
Let's say I have an Asp.net WebForms application that has:
HttpModule
instead in global.asax
Here are some questions:
UrlRoutingModule
to run only when requests are made for a particular subfolder but is not configured in other parts of the app?Upvotes: 4
Views: 1818
Reputation: 61599
This is possible, in fact, as they will be running in the context of the same application, it shouldn't be an issue. What you may have to do is register yourself a new ViewEngine that points to /MvcFolder/Views for your views. The root of the application will still be ~/ so you may need to ensure your routes take this into consideration, e.g. by having something like 'MvcFolder/{controller}/{action}' etc as routing rules.
MVC and WebForms apps can run side by side with no issues. The UrlRoutingModule will match any rules before the request reaches the WebForms HttpHandler, so be wary of routing any rules such as 'DoSomething.aspx', as this will be intercepted by MVC.
If you choose not to register the UrlRoutingModule in the base web.config, you can probably register it in the /MvcFolder/web.config file. This will stop any routes being matched outside the /MvcFolder.
Why are you registering the rules in a HttpModule? These will run for each request, so are you sure you are not registering rules in each request unnecessarily?
Upvotes: 4