Is it possible to share a masterpage between MVC and webforms?

Posted by Craig Quillen on Stack Overflow See other posts from Stack Overflow or by Craig Quillen
Published on 2009-05-08T19:31:02Z Indexed on 2010/05/11 21:14 UTC
Read the original article Hit count: 290

I am adding MVC to a project that has MANY legacy webform pages. This works fine. However, I currently have a separate masterpage for MVC and for the webforms. The two master pages produce essentially identical output. I'd really like to kill the webforms one and just use the MVC master page with all my pages and stay DRY.

Not being DRY has already bitten me a couple times when I forgot to change both.

I tried doing the obvious way and just pointing the webform content page's MasterPage attribute at the MVC masterpage. This throws an error saying the MVC masters only work with MVC views.

This seems like it would be a pretty common problem with mixed MVC and webform projects. My MVC master isn't doing anything with ViewData, so I don't see any reason the webforms couldn't use them.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about webforms