Answer below.

> so I wonder if it would happen in Mono too. The bug is simple, supose we
> have the following in an aspx:
> <script runat="server">
>    void ProcessClick( object sender, EventArgs args )
>    {
>       string sql = @"<script language='javascript'>";
>       sql += @"alert('";
>       sql += nome.Value;
>       sql += "');";
>       sql += @"</script>"; // Here is the PROBLEM!
>       this.RegisterClientScriptBlock( "JJ", sql );
>     }
> </script>
> The parser  will only "copy" to the class definition the code from <script
> runat=server> to <script>. The problem is that he thinks that the
> "</script>" literal is the tag end... So in the class definition we will
> have only:
> 
>   void ProcessClick( object sender, EventArgs args )
>    {
>       string sql = @"<script language='javascript'>";
>       sql += @"alert('";
>       sql += nome.Value;
>       sql += "');";
>       sql += @"
> 
> Witch produces a compiler error. Would this happen in Mono? If not, should
> it happen?


I can't answer the "will it happen in Mono question", but a solution to the
problem is to just divide your </script> tag up:

        sql += @"</scr" + "ipt>"; // Here is the SOLUTION!

That will work in any implementation that has the bug.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to