Very simple declaration in masterpage causing this error
"Compiler Error Message: CS0103: The name 'User' does not exist in the current context"
here is the masterpage codebehind file
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (User.IsInRole("Administrators"))
ImageButton.Visible = true;
can anyone help?
MasterPage generates parser error
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Sateesh ArvetiRank #96 · 22.3K reputationPosted Jul 14, 2008, 11:30 PM EDT
I suppose there is no problem with Master Page.Please use HttpContext.Current.User instead of User.Since,it is saying User does not exist.