title: Can't get Session variable the way I want to
body: <pre><code>Partial Class Preferences_MyPreferences
      Inherits System.Web.UI.Page
  
      Dim userID As String = Session("UserID")
  </code></pre>
  
  <p>This is just a page in asp.net.  I want to be able to grab the Session("UserID") but every time I try, I get this error:</p>
  
  <p><em>Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.</em></p>
  
  <p>If I put that Dim userID inside say the Page_Load Event, then it works fine.  Why does it have to be inside an event?  I want to dim it once, and use it throughout the page.</p>