CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft VBScript compilation (0x800A0409) Unterminated string constant - Response.Write

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    68
  • Date Created
    Sunday, December 12, 2010
  • Last Updated
    Sunday, December 12, 2010
  • This Article Has been Viewed
    9258 times
  • Short Desc
    Using the Response.write you have to make sure that you do not use any illegal characters within the string. If you do, you will get a #800A0409 Unterminated string constant.
  • Details
    Writing a Response.Write you will sometimes mistakenly write out a typical asp code with the accompanying brackets, this is not allowed in a response.write.
    As seen in the error below

     
    Microsoft VBScript compilation (0x800A0409)
    Unterminated string constant
    /Inserts.asp, line 86, column 150
    response.write"<table><tr><td style=""border:1px #000000 dotted; padding:5px;""><a href=""?Type=Profile&rhcid="&MUID&"""><img src=""http://<%=msiteurl
    --------------------------------------------------------------------------------^
  • Recreate Issue
    To recreate this error.

    <%
    response.write"<table><tr><td><%=getValue%></td></tr></table>"
    %>


    The above example has the <%=%> which is illegal in a Response.Write.
  • Resolve Issue
    When using a Variable within a Response.Write, you cannot use the <%= %> like is used in the example above. Instead, you will use a "&getValue&".

    <%
    response.write"<table><tr><td>"&getValue&"</td></tr></table>"
    %>


    As you can see in the example above, the proper way is to use the "& &" wrapped around our variable. This will add the value without the need of the typical asp brackets.