views:

43

answers:

1

I have an aspx page where I put a script tag with .net "if" and "else".
The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output.

The code itself (Simplified example):

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

The cropped output:

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

Does anybody have a clue?

A: 

I would sugest it is throwing some kind of exception when it isn't working and not outputting the full error message. Rather than doint it that way, use a Literal control and build up the script tag in the code behind. That way you can debug and see what the problem is.

Ben Robinson
Thanks. The problem is that it happens only in production servers, and changes there are not easy. I was thinking more in the direction of faulty IIS configuration. I will do like you suggested, but it'll take two weeks or so until it goes to production... Thanks.
Nir
Ben Robinson