In my site I have the same MasterPage for both MVC Views and WebForm Pages.
I want to use ViewData inside the MasterPage code behind.
I'm getting an exception:
A ViewMasterPage can be used only with content pages that derive from ViewPage or ViewPage.
public partial class MasterPage : System.Web.Mvc.ViewMasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
ViewData["X"] = "data";
This Code worked in a WebSite project - but I just converted to Web Application and I can't get it work run.
The Content Page inherits System.Web.Mvc.ViewPage
The ViewData need to be the same object in the pages and masterPages code behind.
Thanks
Rafael.