Script tag in ASPX page is written partially (output stopped at random)
<p>I have an aspx page where I put a script tag with .net "if" and "else".<br>
The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output.</p>

<p>The code itself (Simplified example):</p>

<pre><code>&lt;body id="body" runat="server"&gt;
&lt;form id="form1" runat="server"&gt;some HTML
    &lt;script type="text/javascript"&gt;
         window.addEvent('domready', function() { 
           var x = "nothing";
           &lt;% if(someCondition){%&gt;
           x = "2";
           &lt;%} else {%&gt;
           x = "3";
           &lt;%}%&gt;
          });
    &lt;/script&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>The cropped output:</p>

<pre><code>&lt;body id="body" runat="server"&gt;
    &lt;form id="form1" runat="server"&gt;some HTML
        &lt;script type="text/javascript"&gt;
             window.addEvent('domready', function() { 
               var x = "nothi
        &lt;/script&gt;
    &lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>Does anybody have a clue?</p>
