title: Accessing members from code-behind
body: <p>I'm trying to access a variable in the aspx page which is defined in the code-behind. </p>
  
  <p>I get the error:</p>
  
  <blockquote>
    <p>XXX is not declared. It may not be accessible due to it's protection level.</p>
  </blockquote>
  
  <p>If I instead write <code>&lt;%=Me.RM.GetString("XXX")%&gt;</code> I get:</p>
  
  <blockquote>
    <p>XXX is not a member of 'ASP.XXXXXX.aspx'</p>
  </blockquote>
  
  <p>What I've tried/checked:</p>
  
  <ul>
  <li>Tried to change the field to public (it was protected)</li>
  <li>Created a property and tried to access it instead</li>
  <li>Made sure that <code>CodeBehind</code> and <code>Inherits</code> attributes are correctly defined in the <code>&lt;%@Page %&gt;</code> directive.</li>
  </ul>
  
  <p>The strange thing is that all fields that are defined in the <code>.designer.vb</code> file is found in the markup. (I've tried to declare the variable in the designer file too ;))</p>
  
  <p><em>(I've converted a ASP.NET v1.1 site to a ASP.Net 4.0 web application. Started with a conversion to 4.0, then right-click on project and selected "Convert to webapplication" per suggestion from VStudio.)</em></p>