• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Passing & as a parameter value

Is there a way of passing an & as a querystring value.

We are having a problem as obviously the & is used to seperate parameters but we need to pass one as part of a paramater.

2.asp?CoName=Alf & Burns
0
Kels
Asked:
Kels
  • 2
  • 2
  • 2
  • +1
1 Solution
 
Jay ToopsCommented:
You must use the function urlencode("Alf & Burns")

example:

<%
response.write(Server.URLEncode("http://www.w3schools.com"))
%>Output:

http%3A%2F%2Fwww%2Ew3schools%2Ecom

special characters are meta-escaped using this
and are AUTOMATICALLY decoded by the server
so when you are processing this with your handler
you don't have to do anything else.

Jay
0
 
philjones85Commented:
2.asp?CoName=Alf & Burns

place %26 in place of & and place %20 in place of spaces


string should be:

2.asp?CoName=Alf%20%26%20Burns
0
 
philjones85Commented:
http://www.w3schools.com/html/html_ref_urlencode.asp

complete list of url encoded characters
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
YZlatCommented:
try this:

strString = replace(strString,"&","&amp;")
0
 
YZlatCommented:
also try

strString=replace( strString,"&","and")
0
 
davidlars99Commented:
hi,
in javascript you'd do escape(2.asp?CoName=Alf & Burns)
and unescape()

cheers!
 dave
0
 
Jay ToopsCommented:
HI.. could you award points for this?
Id really appreciate it..

Jay
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now