title: How to create a Session Variable in a Public Property using VB.Net
body: <p>I have already asked a similar question earlier, but this is doing my head in! On ASPX Page, I have this property:</p>
  
  <pre><code>Public ReadOnly BreadQuestionnaire as Bread 
                            Implements IQuestionnaire.BreadQuestionnaire
         Get
             If Me.Session("BreadQuestionnaire") Is Nothing Then
                Me.Session("BreadQuestionnaire") = New Bread()
             End If
         Return TryCast(Me.Session("BreadQuestionnaire"),Bread)
        End Get
  End Property
  </code></pre>
  
  <p>The issue I have is as follows:</p>
  
  <ul>
  <li>Staying on the page, when I enter the property for the first time the check to see if the session exists returns true and the session variable is never created</li>
  <li>This then causes me an issue as I am then not able to set a value for the session based upon that object</li>
  <li>I have also noticed that playing around on the page that the session is not being held on post back when I just set a session on the page.</li>
  </ul>
  
  <p>Can anyone please help?</p>