Microsoft Knowledge Base Email Alertz

(316174) - When you use a /SCRIPT Hypertext Markup Language (HTML) tag inside a quoted string, the tag is treated as a closing tag rather than as a portion of the string.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 316174 - Last Review: February 11, 2004 - Revision: 2.6

PRB: The </SCRIPT> Tag Is Treated As a Closing Tag When Inside a Quoted String

This article was previously published under Q316174

On This Page

SYMPTOMS

When you use a </SCRIPT> Hypertext Markup Language (HTML) tag inside a quoted string, the tag is treated as a closing tag rather than as a portion of the string.

RESOLUTION

To work around this behavior, do not directly use the </SCRIPT> tag inside a script section. Instead, you can use alternatives such as the following tag:
chr(60) & "/SCRIPT>
				

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Copy the following code to a Script.aspx page, and then save it to your Web server:
    <script language="vb" runat="server" id="Script1">
        Private Sub scripTest(ByVal sender As System.Object, ByVal e As System.EventArgs)
    
    	Dim myStr as String
    				
    	myStr = "</script>"
    
        End Sub
    </script>
    
    <HTML>
    	<HEAD>
    		<title>WebForm1</title>
    	</HEAD>
    	<body>
    		<form id="Form1" method="post" runat="server">
    			<asp:Button OnClick="scripTest" id="Button1" style="Z-INDEX: 101; LEFT: 232px; POSITION: absolute; TOP: 62px" runat="server" Text="Button" Width="273px" Height="94px"></asp:Button>
    		</form>
    	</body>
    </HTML>
    
    					
  2. Reference the test page in your Web browser, and the following error message appears:
    Compiler Error Message:BC30648: String constants must end with a double quote
  3. Modify the Script.aspx page, and then change the following line of code from:
    myStr = "</script>"
    					
    to:
    myStr = chr(60) & "/script>"
    					
    Note that the Script.aspx page functions as expected when you change the code.

APPLIES TO
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
  • Microsoft Active Server Pages 4.0
Keywords: 
kbprb kbwebforms KB316174
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate