When upgrading a dotnet Web Site based on asp.net WebForms to a Web App I'm having trouble with Master pages.
My Master pages contain, in their .aspx file markup, references like this:
<div>
Name: <% =GetUserName() %> Account: <% =AccountId %>
</div>
GetUserName()
is a protected method defined in my master page's codebehind file, and AccountId
is a protected field in the same place.
After doing the Web App upgrade (which involves automatically generating a Site.Master.designer.cs
codebehind file to accompany my own Site.Master.cs
codebehind file) compilation of the Master page (not the codebehind) starts to fail, rejecting the protected member references in the <% =GetUserName() %>
constructs. VS 2015 Intellisense says GetUserName not defined in this context.
But the Go To Definition... item on VS2015's context menu still works for the offending protected member references. Weird.
When I make a new Web App project from scratch, it doesn't have this problem. How can I fix this? Or is there something special about upgraded Web Site projects that prevents these protected member references?