I have a slight issue with a string being built in my code. When I debug my page the url is incorrect. For example Google’s url is this when clicking on the link on my page. http://www.google.co.uk%22%22/
See below for code.
sb.Append(@"<a href=" + r["Url"].ToString() + "\"" + @""" target=""blank"">");
sb.Append(@"<img src=""../ShowImage.ashx?id=" + r["Image_id"] + "\" title=\"" + r["Title"].ToString() + "\" alt=\"" + r["Alt_text"].ToString() + "\" >");
sb.Append("</a>");
Is there a mistake in how I am building my string?
Thanks.
You’re mixing quotes escaped with
\("\"") with quotes escaped with ” (@""") and have one too many. Try this instead: