TERRIBLE BUG IN ASP SERVER!!!

  • Thread starter Thread starter Dannie Juge
  • Start date Start date
D

Dannie Juge

I found a terrible bug in ASP server, does ANYBODY know
how to fix this?!! The error happens if you have
a "<script>" tag into another script, EVEN WHEN IT'S
COMMENTED OR INTO A STRING (OR BOTH). Here's a simple
example of this:

<%@Language=vbscript%>
<HTML>
<HEAD>
<SCRIPT language='JavaScript'>
function showAlert(){
/*
This comment generates an error!!!!
The error is:
"Active Server Pages, ASP 0138 (0x80004005)
A script block cannot be placed inside another
script block."
alert("You are running a <script>");
Just because the <script> tag is included into the
script! But the <script> tag is firstable into a String
and then into a comment.

This error should not ever happened. The error happens in
the server side, it means, the ASP server has this
terrible bug!!
*/
}
</SCRIPT>
</HEAD>
<BODY>
<form>
<input type="button" onclick="javascript:showAlert
();">
</form>
</BODY>
</HTML>
 
Dannie Juge said:
I found a terrible bug in ASP server, does ANYBODY know
how to fix this?!! The error happens if you have
a "<script>" tag into another script, EVEN WHEN IT'S
COMMENTED OR INTO A STRING (OR BOTH). Here's a simple
example of this:

This error should not ever happened. The error happens in
the server side, it means, the ASP server has this
terrible bug!!

Yup, it doesn't check to see if it is a valid <script> block. Seen it many
times, struggled with it until I realized, why not just use "<" & "script>" to
concatenate the two strings together? :)

Mythran
 
Dannie said:
I found a terrible bug in ASP server, does ANYBODY know
how to fix this?!! The error happens if you have
a "<script>" tag into another script, EVEN WHEN IT'S
COMMENTED OR INTO A STRING (OR BOTH). Here's a simple
example of this:

<%@Language=vbscript%>
<HTML>
<HEAD>
<SCRIPT language='JavaScript'>
function showAlert(){
/*
This comment generates an error!!!!
The error is:
"Active Server Pages, ASP 0138 (0x80004005)
A script block cannot be placed inside another
script block."
alert("You are running a <script>");
Just because the <script> tag is included into the
script! But the <script> tag is firstable into a String
and then into a comment.

This error should not ever happened. The error happens in
the server side, it means, the ASP server has this
terrible bug!!
*/
}
</SCRIPT>
</HEAD>
<BODY>
<form>
<input type="button" onclick="javascript:showAlert
();">
</form>
</BODY>
</HTML>

This is not a bug.

Characters that are special to HTML that you want displayed in a browser
or presented to the client Scripting runtime should be encoded as
character entities:

& -> &amp;
< -> &lt;
 
I would call it an oversight more than a bug. But, there are few people who
stick this type of code into JavaScript, so it is likely they did not
envision it.

It is quite easy to solve:

ASP Page
-----------
<%@Language=vbscript%>
<HTML>
<HEAD>
<SCRIPT language='JavaScript' src="NoScript.js">
</SCRIPT>
</HEAD>
<BODY>
<form>
<input type="button" onclick="javascript:showAlert
();">
</form>
</BODY>
</HTML>

NoScript.js
------------
alert("Don't get annoyed by the <script>");

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Back
Top