0

Currently we have a new menu item to our existing asp.net web forms application. We have decided to go with MVC for this. Please note that we have to share the same masterpages, css and Jquery files. We are currently planning to render the view inside a div in our aspx pages.

  1. Is there a better way to accomplish this?
  2. What are the limitations of our approach?
  3. Can we leverage the MVC test cases in this approach?

Thanks

1
  • You can't use the same master pages. MVC can't use Web Forms master pages. Commented Jul 7, 2014 at 16:00

2 Answers 2

0

MVC is a stateless, disconnected architecture, you can not access the master page or aspx controls directly in the controller as aspx.cs does, secondly it is not possible to use the classic asp.net master page with mvc.

The things you can re use from existing project are:

  • UI Templates (design)
  • JS files
  • CSS files
  • Business Logic
  • Database
Sign up to request clarification or add additional context in comments.

Comments

0

You can't use same master pages. You can't reuse ASP.NET MVC for some parts of your webforms view and vice versa. Either your view is completely on webforms or on ASP.NET MVC. And theoretically even mix of webforms with mvc in one web application could be problematic, but practically possible (see below point 1). So generally answer to your question is no.

If you are looking to ASP.NET MVC, you should think about step-by-step migration of your project to it.

Actually there are a couple of possibilities how to migrate

  1. Mix in one project ASP.NET web forms and ASP.NET MVC. Technically it is possible. But it is some kind of hack. Your transition will be seamless but you can't your ASP.NET views. I will not recommend it. You can find this approach here http://www.devcurry.com/2013/05/adopting-aspnet-mvc-enhancements-in.html

  2. In one solution use different projects for your webforms and mvc projects. In fact these are 2 different web application which typically could have common authentication, and there is question with webforms state. To solve problem with authentication you need create separate web service for it, which will be used by both. To solve problems with session state, use distributed caching for both, and try to change thinking from webforms state to caching, because mvc is actually stateless. Then for particular views you can redirect between views of both portals

Comments

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.