asp.net c# aspx if statements not working
<p>I do some asp programming, but have not worked with asp.net or aspx scripts.
I am trying to create a script that will send an html file if a cookie is not set, but send a pdf if it is.  I keep getting a runtime error.</p>

<p>Here is my code:</p>

<pre><code>&lt;%@ Page Language="C#" %&gt;
&lt;%
HttpCookie mycookie = Request.Cookies["CHECK"];
if (mycookie.Value == ""){
 Response.ContentType = "text/html";
 Response.Clear();
 Response.TransmitFile("forbidden.html");
 Response.End();
}
else
{
 Response.ContentType = "application/pdf";
 Response.Clear();
 Response.TransmitFile("test.pdf");
 Response.End();        
}
%&gt;
</code></pre>

<p>I have tested the response code block for the html and the pdf and both work fine and sends the files to the browser. I added the line that sets mycookie with the cookie information and it still works.  When I add the if logic, I get a runtime error.</p>

<p>Can someone tell me what I am doing wrong?</p>

<p>Thanks in advance for any help.</p>
