Trying to cast and access PreviousPage values
<p>Hi I have the follwing code in my default.aspx:</p>

<pre><code>&lt;asp:Button AccessKey="Y" Height="25px" runat="server" ID="myButton"
    Text="hello" OnClick="clickit" PostBackUrl="~/Login/Default.aspx" /&gt;
</code></pre>

<p>and this code in my login default page code behind:</p>

<pre><code>        Default prev = PreviousPage as Default;
        if (prev != null)
        {
            label1.Text = prev.GetText;
        }
</code></pre>

<p>But "prev" always is null, PreviousPage however is not null, when I add this derivitive to the login page:</p>

<pre><code>&lt;%@ PreviousPageType  VirtualPath="~/Default.aspx" %&gt;
</code></pre>

<p>I get the error System.InvalidCastException: Unable to cast object of type 'ASP.default_aspx' to type 'Default'.</p>

<p>Anyone know whats going on? Why is prev set to null (and hence I can't access any of its values)?</p>
