You have to realize that this is markup language.  Before you can even
compile this as an ASP.NET application, it has to be parsed first.  The
parser is not going to be looking for strings or variables or anything
else except for markup tags.  </script> is a markup tag to the parser;
"</scr" + "ipt>" is something else.  Until you parse the markup, you
cannot get into the inner workings of the ASPX file.

I hope this makes sense.

Christopher Reed
Web Applications Supervisor
Information Technology
City of Lubbock
[EMAIL PROTECTED]
"The oxen are slow, but the earth is patient."

>>> [EMAIL PROTECTED] 8:38:37 AM 7/15/2004 >>>
hello. So could you please tell why this is not a bug? how can a
script
section interpret a string as a tag?

Thanks.

Regards,
Luis

>It's not a bug. Try "</scr" + "ipt>" so it won't read it incorrectly.
>
>Hope this helps!
>
>Christopher Reed
>Web Applications Supervisor
>Information Technology
>City of Lubbock
>[EMAIL PROTECTED]
>"The oxen are slow, but the earth is patient."
>
>
>
>>>>[EMAIL PROTECTED] 7:27:49 AM 7/15/2004 >>>
>>>>
>>>>
>Hello. last night I was doing some tests on asp.net and I've foud
that
>if write code like this the page doesn't compile:
>
><%@ Page Language="C#"  %>
><html >
> <head  runat="server">
>     <title>Untitled Page</title>
>  </head>
> <body>
>    <script runat="server">
>         void ProcessClick( object sender, EventArgs args  )
>         {
>                string sql = @"<script  language='javascript'>";
>                sql += @"alert('";
>                sql += nome.Value;
>                sql += "');";
>                sql += @"</script>"; //ERROR HERE
>                this.RegisterClientScriptBlock( "JJ", sql );
>        }
>        </script>
>     <form id="form1" runat="server">
>            <input type="text" runat="server" id="nome" />
>             <input type="button" runat="server" value="Click me"
>id="bt" onserverclick="ProcessClick" />
>    </form>
>    </body>
></html>
>
>Well, the problem is that the asp.net parser ends the server script
>tag
>when it sees the </script> of the sql variable. I've also posted this
>in
>a local newsgroup and one of its members gave me a workaroud: write
>sql
>+= "<" + @"/script>" instead of what I have written.
>
>Well, what I'd like to know is if this is bug or if this is reported
>somewhere.
>
>thanks.
>
>Regards,
>Luis
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
>http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
http://discuss.develop.com
>
>
>

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to