title: ASP.NET Public Variable at Code Behind is not accesible in .aspx
body: <p>This is a simple example of what is happening here.</p>
  
  <p>Default.aspx </p>
  
  <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="base._default1" %&gt;
  
      &lt;!DOCTYPE html&gt;
  
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
          &lt;% Response.Write(sName) %&gt;
          &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>and the code behind default.aspx.vb</p>
  
  <pre><code>Public Class _default1
      Inherits System.Web.UI.Page
  
      Public sName As String = "Jimmy"
  
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
      End Sub
  
  End Class
  </code></pre>
  
  <p>the error is </p>
  
  <p>BC30451 'sName' is not declared. It may be inaccessible due to its protection level.    base    C:\Users\Jimmy\Documents\Visual Studio 2015\Projects\base\base\teste\default.aspx   12  </p>
  
  <p>Where is the problem ?</p>