Kevin Pang
Kevin Pang

Reputation: 41442

Integration ASP.NET web forms blogging framework into ASP.NET MVC

Is there any way to use something like BlogEngine.NET (a blogging framework developed on the ASP.NET web forms model) in an ASP.NET MVC application? I want something where I can simply go to http://rooturl/blog and have it fire up the BlogEngine.NET site. I'm assuming that the ASP.NET MVC framework will intercept this call however and try to route it to the "BlogController"'s Index function though. Is there any way around this or is this a non-issue?

Upvotes: 2

Views: 271

Answers (1)

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26956

Scott Hanselman wrote on this a while back:

Plug-In Hybrids: ASP.NET WebForms and ASP.MVC and ASP.NET Dynamic Data Side By Side

But if I recall correctly, if you don't have a controller that matches /blog then the engine will default to sending the request to your /blog folder, and away you go, on top of that, as Scott notes:

Why doesn't ASP.NET MVC grab the request? Two reasons. First, there's an option on RouteCollection called RouteExistingFiles. It's set to false by default which causes ASP.NET MVC to automatically skip routing when a file exists on disk.

However, he goes on to note that you could just add the following at the top of your route definitions:

routes.IgnoreRoute("blog/{*pathInfo}");

Which would then ignore all requests to /blog/

Upvotes: 2

Related Questions