24

I have an existing ASP.NET WebForms 3.0 application that works just fine. I upgraded it to ASP.NET 4 and it still works great, but now I want to add some ASP.NET MVC pages to it. I don't want to rewrite the application.

Any suggestions? Can I mix them? How to work it? Any tutorials for me?

2 Answers 2

11

Take a look at Scott Hanselman's blog article on this very topic:

Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications

Sign up to request clarification or add additional context in comments.

1 Comment

This advice might be obsolete with ASP.NET 4. I'm searching for it but haven't found it yet. I know Scott now talks about how Microsoft now recommends mixing them together in the same project. I think his article might still work -- it's definitely worth a try. But MVC 4 changes a few things about the web project initialization so his old blog post might break in a few places.
4

You have to mention this line of code in the Global.asax file in the MVC application.

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

This disables the MVC routing for the files of extension .aspx

2 Comments

Thanks all~~is work for me. but how do i call the MVC application page in Asp.net webform application? since Url link and Html link is not valid under .net html page.. any example..?
You can use <%=ResolveUrl("~/{controller}/{action}/")%> in your anchor links. Substiture {controller} with your controller name and {action} with your action name. eg.: <%=ResolveUrl("~/home/index/")%>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.