Newbie question - redirect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a two-page web app. Page A sets a cookie. Page B reads the cookie. If
the cookie exists, I want the user to be redirected away from Page B. I set
tracing on Page B, and it is reading the cookie and the cookie's value, but
my Response.Redirect is not working. Here is the code I have in my page head
section:

<script language="C#" runat=server>
void Page_Load(Object sender, EventArgs E)
{
HttpCookie MyCookie = Request.Cookies["cookie123"];
if (MyCookie != null)
{
Response.Redirect("inquire_thanks.aspx");
}
}
</script>


Am I missing something obvious? Thanks for any help...
 
Matt,

Your code looks fine to me which leads me to believe that the Page B is not
executing the Page_Load event. Do you have AutoEventWireup set to true? or
have the events disabled in some other way?


Hope this helps.
 
Brian: Thanks. That was it. I can't believe I read all those stinking
QuickStart tutorials about cookies and not one of them mentioned
AutoEventWireup. I appreciate it....
 
Back
Top