TERRIBLE BUG IN ASP SERVER!!!

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>
 
M

Mythran

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
 
M

mikeb

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;
 
C

Cowboy \(Gregory A. Beamer\)

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!
**********************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top