How to check is page is redirected from previous page or not in asp.net
<p>In Page  1 on button click I redirect the page to page 2 with msgid, and in page 2 in page load I check whether the previous page is valid. So i check <code>(this.Page.PreviousPage != null)</code> but this is always null and the page gets redirected to page 1. I am doing this so that no one can change the msgid in the url. How can I solve this issues. thanks</p>

<p>Page1:</p>

<pre><code>  int msgid = Convert.ToInt32(Hidden_MsgID.Value);
    string url = "Page2.aspx?MsgID=" + msgid;
    Response.Redirect(url);      
</code></pre>

<p>Page2:</p>

<pre><code>if (this.Page.PreviousPage != null)
                {
                }
                else
                {
                    Response.Redirect("Page1.aspx");
                }
</code></pre>

<p>instead of response.redirect I used server . transfer and it works
    Server.Transfer(string.Format("ResponseMetric.aspx?MsgID={0}", msgid));</p>
