473,574 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Quotes in a URL Call

Using ASP 3.0

I want to dynamically build a call to another asp page and include some
parameters as part of the call. The basic format of the call is something
like::

"<a href='mypage.as p?id=" & theid & "&location= '" & thelocation &
"'>GO</a>"

where there is a single quote followed by a double quote following the
...location=... and vica-versa after the variable

My problem is that the variable thelocation can include a single quote or a
double quote. I tried Server.URLEncod e and that didn't work. I got a string
that ended up causing a Page Not Found (it encoded the dot in the page name
and that didn't work)

How can I encode the data so that quotes will be accepted in this type of
call?

Wayne
Jul 19 '05 #1
4 14898
Did you decode the URL at the other end when you encoded
it?

Try the following code before you reconstruct the call to
the page..

<%
Function myURLDecode(str String)
strString = Replace(strStri ng, "%2F", "/")
strString = Replace(strStri ng, "%7C", "|")
strString = Replace(strStri ng, "%3F", "?")
strString = Replace(strStri ng, "%21", "!")
strString = Replace(strStri ng, "%40", "@")
strString = Replace(strStri ng, "%5C", "\")
strString = Replace(strStri ng, "%23", "#")
strString = Replace(strStri ng, "%24", "$")
strString = Replace(strStri ng, "%5E", "^")
strString = Replace(strStri ng, "%26", "&")
strString = Replace(strStri ng, "%25", "%")
strString = Replace(strStri ng, "%2A", "*")
strString = Replace(strStri ng, "%28", "(")
strString = Replace(strStri ng, "%29", ")")
strString = Replace(strStri ng, "%7D", "}")
strString = Replace(strStri ng, "%3A", ":")
strString = Replace(strStri ng, "%2C", ",")
strString = Replace(strStri ng, "%7B", "{")
strString = Replace(strStri ng, "%2B", "+")
strString = Replace(strStri ng, "%2E", ".")
strString = Replace(strStri ng, "%2D", "-")
strString = Replace(strStri ng, "%7E", "~")
strString = Replace(strStri ng, "%2D", "-")
strString = Replace(strStri ng, "%5B", "[")
strString = Replace(strStri ng, "%5F", "_")
strString = Replace(strStri ng, "%5D", "]")
strString = Replace(strStri ng, "%60", "`")
strString = Replace(strStri ng, "%3D", "=")
strString = Replace(strStri ng, "%27", "'")
strString = Replace(strStri ng, "+", " ")
strString = Replace(strStri ng, "%22", Chr(34))
myURLDecode = strString
End Function
%>
Jul 19 '05 #2

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Using ASP 3.0

"<a href='mypage.as p?id=" & theid & "&location= '" & thelocation &
"'>GO</a>"

where there is a single quote followed by a double quote following the
..location=... and vica-versa after the variable

My problem is that the variable thelocation can include a single quote or a double quote. I tried Server.URLEncod e and that didn't work. I got a string that ended up causing a Page Not Found (it encoded the dot in the page name and that didn't work)


Sounds like you were possibly trying Server.URLEncod e in the wrong place...

I would say this should work :

Response.write "<a href='mypage.as p?id=" & Server.URLEncod e(theid) &
"&location= '" & Server.URLEnCod e(thelocation) & "'>GO</a>"
Jul 19 '05 #3
Thanks Dan. You were right. I used the URLEncode on the whole call instead
of just the pieces that needed it.

Wayne

"Dan Boylett" <ms*******@cros sdata.co.uk> wrote in message
news:ek******** ******@TK2MSFTN GP10.phx.gbl...

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Using ASP 3.0

"<a href='mypage.as p?id=" & theid & "&location= '" & thelocation &
"'>GO</a>"

where there is a single quote followed by a double quote following the
..location=... and vica-versa after the variable

My problem is that the variable thelocation can include a single quote
or a
double quote. I tried Server.URLEncod e and that didn't work. I got a string
that ended up causing a Page Not Found (it encoded the dot in the page

name
and that didn't work)


Sounds like you were possibly trying Server.URLEncod e in the wrong

place...
I would say this should work :

Response.write "<a href='mypage.as p?id=" & Server.URLEncod e(theid) &
"&location= '" & Server.URLEnCod e(thelocation) & "'>GO</a>"

Jul 19 '05 #4
Very Handy function. Thanks

Wayne

"Kevin" <an*******@disc ussions.microso ft.com> wrote in message
news:03******** *************** *****@phx.gbl.. .
Did you decode the URL at the other end when you encoded
it?

Try the following code before you reconstruct the call to
the page..

<%
Function myURLDecode(str String)
strString = Replace(strStri ng, "%2F", "/")
strString = Replace(strStri ng, "%7C", "|")
strString = Replace(strStri ng, "%3F", "?")
strString = Replace(strStri ng, "%21", "!")
strString = Replace(strStri ng, "%40", "@")
strString = Replace(strStri ng, "%5C", "\")
strString = Replace(strStri ng, "%23", "#")
strString = Replace(strStri ng, "%24", "$")
strString = Replace(strStri ng, "%5E", "^")
strString = Replace(strStri ng, "%26", "&")
strString = Replace(strStri ng, "%25", "%")
strString = Replace(strStri ng, "%2A", "*")
strString = Replace(strStri ng, "%28", "(")
strString = Replace(strStri ng, "%29", ")")
strString = Replace(strStri ng, "%7D", "}")
strString = Replace(strStri ng, "%3A", ":")
strString = Replace(strStri ng, "%2C", ",")
strString = Replace(strStri ng, "%7B", "{")
strString = Replace(strStri ng, "%2B", "+")
strString = Replace(strStri ng, "%2E", ".")
strString = Replace(strStri ng, "%2D", "-")
strString = Replace(strStri ng, "%7E", "~")
strString = Replace(strStri ng, "%2D", "-")
strString = Replace(strStri ng, "%5B", "[")
strString = Replace(strStri ng, "%5F", "_")
strString = Replace(strStri ng, "%5D", "]")
strString = Replace(strStri ng, "%60", "`")
strString = Replace(strStri ng, "%3D", "=")
strString = Replace(strStri ng, "%27", "'")
strString = Replace(strStri ng, "+", " ")
strString = Replace(strStri ng, "%22", Chr(34))
myURLDecode = strString
End Function
%>

Jul 19 '05 #5

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

Similar topics

12
6528
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html ...
58
10084
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
22
25565
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet =...
3
1703
by: Brian | last post by:
Hope someone can help ..... Have a function which creates a HTML HREF function fLink(aText) { return '<a href=javascript:DoLinkSearch("'+aText+'")>'+aText+'</a>'; } If the parameter value is "simple" (no spaces), then the function returns the HTML as expected However, if the value does contain spaces, the HTML returned is cut off at
1
1670
by: I.am.the.Buddha | last post by:
I am still learning asp and sql. I am having trouble with passing a variable to within an sql statement. I am sure it is something simple like misuse of quotes. Since it may help if i say what i am trying to generally accomplish here. This is an access database for products and customers. We have a counter for each product (such as...
5
1760
by: nephish | last post by:
hey there, can anyone tell me if this is legal php/mysql ? i am trying to write a simple function to get a single stat from a single table. eg.. $field = 'phone_number'; $customer = 'fred';
0
2408
by: kencana | last post by:
hi All, I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully.. The following is the error message i get when i pass more than one data: "SoapFault exception: looks like we got no XML document in C:\Program...
6
7289
by: rynato | last post by:
I am embarrassed that I cannot figure this out, as it seems fairly simple. I found a JS function I'd like to use, which animates a layer so that it moves across the screen. The problem is the function, as found, simply names the DIV directly. I want to be able to use the function in the HTML to pass the ID of the DIV which gets moved....
5
9846
by: moni | last post by:
Hi.. I am trying to use javascript for google maps display. If I call the javascript function from my aspx file I use: <input type="text" id="addresstext" value="Huntington Avenue, Boston, MA" name="yourName" style="width: 287px" />
0
7732
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8063
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8243
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7822
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5302
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.