title: Property in viewstate different on one page to another
body: <p>This is really weird error i'm getting and i'll try and explain as best I can.</p>
  
  <p>I have two pages - Page 1 (form) and Page 2 (completed page)</p>
  
  <p>From page 1 I put a variable into a database and then do a server.transfer to page two like so...</p>
  
  <pre><code>Server.Transfer("Page2.aspx", True)
  </code></pre>
  
  <p>On page 2 I then grab the variable called <code>paymentOnHold</code> which is set on Page 1 and goes into the database...</p>
  
  <p>Here is how I set <code>paymentOnHold</code> on Page 1</p>
  
  <pre><code>Public Property paymentOnHold() As String
      Get
          Dim _paymentOnHold As Object = ViewState("paymentOnHold")
          If _paymentOnHold IsNot Nothing Then
              Return CType(_paymentOnHold, String)
          Else
              Return Nothing
          End If
      End Get
      Set(ByVal value As String)
          If Not String.IsNullOrEmpty(value) Then
              ViewState("paymentOnHold") = value
          Else
              ViewState("paymentOnHold") = Nothing
          End If
      End Set
  End Property
  
  ...
  
  paymentOnHold = Date.Now.ToString("yyyyMMddHHmmss")
  </code></pre>
  
  <p>Here's how I grab the value on Page 2...</p>
  
  <pre><code>Dim myValue As String
  
   If TypeOf PreviousPage Is Page1 Then
  
          myValue = DirectCast(PreviousPage, Page1).paymentOnHold
  
  End If
  </code></pre>
  
  <p>In my development environment where the databases are local the value in the DB and the value on page 2 both match - as you would expect...</p>
  
  <p>In live environment the DB value is 3 or 4 seconds different (before) the one on Page 2 - even though I do not reset it or anything?</p>
  
  <p>This has been driving me crazy for the last few hours and cannot work it.</p>
  
  <p>Does anyone have any ideas/suggestions as to what might be causing this?</p>
  
  <p>Thanks in advance</p>