Passing Data Between ASP.net Pages using vb.net
<p>I am writing <em>my very first</em> asp.net application and am trying to use the PreviousPage property to access data between pages.  Visual 2010 is giving me an error which I don't understand, so I need some help to understand what I am doing wrong.</p>

<p>I have an application where I will bounce between all the pages using Transfer.  That way, from a user perspective there is only ever one url that he sees. This url will be the one that makes him log in to the application (a application controlled function for now) and connect to the database.  I therefore have an sqlclient.sqlconnection object that I wish to hand off to the next page called _dbConnection  this is a private variable in my page class declared ...</p>

<pre><code>   Partial Class Protocol
        Inherits System.Web.UI.Page
        Private _dbconnection As SqlClient.SqlConnection
        Public ReadOnly Property dbConnection As SqlClient.SqlConnection
            Get
                Return _dbConnection
            End Get
        End Property
        ...
</code></pre>

<p>Later down the code, in reponse to a click event on a button</p>

<pre><code>Server.Transfer("PSetup.aspx")
</code></pre>

<p>In PSetup.aspx I have the following</p>

<pre><code>&lt;%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="True" CodeFile="PSetup.aspx.vb" Inherits="PSetup" %&gt;
&lt;%@ PreviousPageType VirtualPath="~/Protocol.aspx" %&gt;
&lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt;
</code></pre>

<p>Which should declare the Protocol class as the previous page</p>

<p>However in PSetup's Page_Load Sub I attempt this</p>

<pre><code>_dbConnection = PreviousPage.dbConnection
</code></pre>

<p>where in this use _dbConnection is a private variable in the new page class.</p>

<p>Visual Studio is giving me an error 'dbConnection' is not a member of 'System.Web.UI.Page'</p>

<p>I have read through the documentation about this several times and I just don't understand what I am doing wrong.  Could someone help me please.</p>
