0

I am trying to get ASP.NET MVC 3 to work on an ASP.NET website project (NOT web application) project that uses WebForms. I have a test page "working". The only issue is within the view when I am in visual studio I get no intellisense and the following issue:

MVC 3 'ViewData' is not declared. It may be inaccessible due to its protection level.

I created an ASP.NET MVC 3 project and a website project and compared the web.config and had made sure to add all the correct references. System.Web.Mvc is referenced in my root web.config. What could I be doing wrong?

1
  • 1
    Uhh.. "What could I be doing wrong?" Everything. You can't use MVC in an ASP.NET Web Site Project. MVC is a Web Application type project, while Web Site projects work very differently, and you can't mix and match the two. Commented Apr 20, 2012 at 19:04

1 Answer 1

1

MVC views are of type ViewPage. http://msdn.microsoft.com/en-us/library/system.web.mvc.viewpage.aspx

Webform pages are of type Page. http://msdn.microsoft.com/en-us/library/system.web.ui.page.aspx

They aren't related. You can't use them interchangably. What are you trying to accomplish? MVC and Webforms can coexist in the same site but they cannot work together like you're trying. MVC requires controllers that are compiled, you cannot use MVC in a runtime-compiled "website".

They handle requests in completely different ways.

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

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.