473,378 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

escaping quotes

Can anybody tell me what is wrong with this code? I am thinking it is
something to do with how I am escaping the quotes.

<img src="pix2.asp?lbmid=" & Request.QueryString("LBMID") & "&LBMEmail="
& Request.QueryString("LBMEmail") & """ width=1 height=1 border=0>

*** Sent via Developersdex http://www.developersdex.com ***
Nov 11 '08 #1
1 1888
Mike P wrote:
Can anybody tell me what is wrong with this code? I am thinking it is
something to do with how I am escaping the quotes.

<img src="pix2.asp?lbmid=" & Request.QueryString("LBMID") &
"&LBMEmail=" & Request.QueryString("LBMEmail") & """ width=1
height=1 border=0>
Two things:
You failed to delineate the server-side code from the client-side html.
Why are you trying to inject a quote there at the end?

Actually 3 things:
You failed to describe your symptoms. At least view the page source after
running the page and show us the resulting img tag, or tell us what the
error message is.

Anyways, the long version:

<img src="pix2.asp?lbmid="
<%Response.Write Request.QueryString("LBMID") %>
&LBMEmail=
<%Response.Write Request.QueryString("LBMEmail") %>
" width=1 height=1 border=0>

The shortcut that most people use:

<img src="pix2.asp?lbmid="<%=Request.QueryString("LBMID ")%>
&LBMEmail=<%=Request.QueryString("LBMEmail")%>" width=1 height=1 border=0>

The idea is to write the html the way it should look with hard-coded values:

<img src="pi******************************@abc.com" width=1 height=1
border=0>

Then replace the hard-coded values with the server-side script blocks. There
is no need to do the concatenation inside the server-script blocks. Yes, you
could have done this:

<img src="pix2.asp?lbmid="<%=Request.QueryString("LBMID ") & "&LBMEmail=" &
Request.QueryString("LBMEmail")%>" width=1 height=1 border=0>

but it can get confusing and there really is no need to do this unless you
are making decisions in the server-side code as to what name-value pairs are
being included in the querystring.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 11 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Reply Via Newsgroup Thanks | last post by:
Folks, This questions is directed towards PHP/MySQL folk and relates to escaping hooks, apostraphe's and other characters that can create a security hole when writing to databases/files. I've...
4
by: Dave Moore | last post by:
Hi All, Can anybody point me to a FAQ or similar that describes what all this stuff is about please?. I'm interfacing with a MySQL database if that's relavent. I've read a couple of books which...
5
by: bobbyballgame | last post by:
I am having a problem calling Stored Procedures: .... dim MyValue, MyOtherValue MyValue = "Bobby's value" MyOtherValue = Bobby's other value" rs.Open "exec MyStoredProc """ & MyValue &...
4
by: sankofa | last post by:
hi, i can't seem to be able to escape my single quote properly... is it even possible in javascript? this is a portion of my code.. var DLEWIS="Pastor Lewis"; .... Sermon is a yser-defined...
1
by: Ted Weatherly | last post by:
Hello, I want to dynamically create a table cell with a textfield in it. The value for the textfield can have quotes. e.g. I have this snippet of javascript code: var td =...
4
by: Stefan Richter | last post by:
How do I encode double quotes and quotes and in a string in VB.NET? It also has to be save for MS SQL Server... Stefan
5
by: Lucian Sandor | last post by:
Hello everyone, While I'm a newbie here, I a not new to google, so please don't send me back, it would be useless. First of all I have to specify I am working on a Blogger.com template, therefore...
7
by: duwayne | last post by:
I have a problem of escaping quotes in javascript. Ex: onclick='alert( "Mister O'Hara" )' onclick='alert( "Mister O\'Hara" )' both gives me an error. How would I escape this?
4
by: agarwalpiyush | last post by:
Hello, I am going nuts with trying to get the following to work: This is what I intend to do: I have a line in /etc/syslog.conf which I need to delete based on ip-address provided to me in a...
3
by: Taras_96 | last post by:
Hi everyone, I'm having a bit of trouble understanding the purpose of escaping nulls, and the use of addcslashes. Firstly, the manual states that: "Strictly speaking, MySQL requires only...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.