PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 27, 2022

[FIXED] Why is Visual Studio warning for an Unterminated String Constant

 April 27, 2022     asp.net, html, string, visual-studio-2015, warnings     No comments   

Issue

In this .aspx file I am getting a warning saying "Unterminated string constant". I've looked into the error and found that it means there is an open single or double quote somewhere. However, I do not have an open single or double quote, but it is still throwing the warning. Why?

The warning underlines the bolded portion below. Notice the bolded single quote at the end.

onclick="window.location='pagename.aspx?aid=<%=VariableName%>'">

<input type="button" name="buttonCancel" class="btn btn-warning btn-sm" value="Cancel" onclick="window.location='pagename.aspx?aid=<%=VariableName%>'">

Solution

Yeah pretty painful. I think it has to do with parsing priority.

Here's another way to write it that won't throw the error.

<input type="button" onclick="<%="window.location=PageName.aspx?aid=" + VariableName%>"/>


Answered By - John Wu
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing