title: Web Controls not recognized in code behind
body: <p>I am working on my first web site (using twitter oAuth) through Visual Studio  2012 for a class. I feel idiotic for having to ask this question as I'm sure it's extremely simple.</p>
  
  <p>I am having trouble getting the codebehind to recognize any web elements on my .aspx page. I'm not sure if I need to change something in the options or if I am just missing something.</p>
  
  <p>I have added a text box, via the toolbox, to "index.aspx" and gave it the id = 'txtUserName'. When I try to assign txtUserName.Text to a variable in the page_load, I get an error saying that 'txtUserName' does not exist in the current context. </p>
  
  <p>Hopefully someone can make me smack my head and that I'm missing a simple tag or something.</p>
  
  <p>index.aspx:</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="True" CodeBehind="index.aspx.cs" Inherits="TwitterTest.index" %&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;TwitterTest!!!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
      Welcome to TwitterTest
  
      &lt;/div&gt;
          &lt;asp:TextBox ID="txtUserName" runat="server" Text=""&gt;&lt;/asp:TextBox&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>index.aspx.cs:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.Mvc;
  using TweetSharp;
  
  namespace TwitterTest
  {
      public partial class index : System.Web.UI.Page
      {
          static void Page_Load(object sender, EventArgs e)
          {
              string UserName = txtUserName.Text;
          }
  
      }
  }
  </code></pre>