title: How to pass a value from Master page to content page in asp.net 4
body: <p>I have no idea why this won't work but I have a function on a master page that gets the logged in user and then displays information about that user on the master page.  I want to be able to pass one property (the user Role to the other pages to use for logic flow.  I can't seem to get the content pages to recognize the property.  </p>
  
  <p>The error message is 
  'System.Web.UI.MasterPage' does not contain a definition for 'Role' and no extension method 'Role' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)'</p>
  
  <p>Any ideas?</p>
  
  <pre><code>public partial class SiteMaster : System.Web.UI.MasterPage
  {
  
      private string role = "Manager";
  
      public string Role
      {
          get
          {
              return role;
          }
          set
          {
              role = value;
          }
      }
  protected void Page_Load(object sender, EventArgs e)
      {
    ...get current logged in user data and display appropriate fields in the master page.
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Content Page</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Portal.aspx.cs" Inherits="Portal" ClientIDMode="AutoID" %&gt;
  &lt;%@ MasterType VirtualPath="~/Site.Master" %&gt;  
  
  &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt;
  </code></pre>
  
  <p>content page.cs</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
  
             string testRole = Master.Role;
  
          }
      }
  </code></pre>