469,934 Members | 1,873 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

losing characters passing a string in ASP passing

Hello reader,

On my site i pass variables from one page to another, this is no problem. But when i'll get a string with a + or & sign for example this NE SO 1.1 + 1.2 string I will lose the + sign when I'll pass it from one page to another. I will get NE SO 1.1 1.2 this result when I'll pass it from one page to another. Even if I do this with the following simple code I will get the same result:
FILE : SENDING.ASP
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     name2 = "NE SO 1.1 + 1.2"
  3. %> 
  4. <a href="t3.asp?name=<%=name2%>" target="frameInfo" > link</a> 
FILE : GETTING.ASP
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     gotname = request.querystring("name")
  3. %>
also then I will lose the + sign and will end with this result:
NE SO 1.1 1.2

Can someone give me a hind to avoid losing these signs?!
Sep 20 '08 #1
2 1569
Krandor
50
If I understand your question correctly, you are passing those values through a query and you are losing those two chracters in the process.

I don't know about the + sign but the & is used in parts of the query to designate the next variable so you are confusing it when it is part of the data.

If you are sending the query to another of your pages, you could use session variables with the whole text instead. If not, you will have to remove the offending characters before you send the query.
Sep 21 '08 #2
jhardman
3,406 Expert 2GB
Those are both protected characters in querystrings. You can either use <%=server.urlEncode(name2)%> (this should work, but I think I have seen some bugs or holes in the implementation) or you can send them as form inputs instead. I could help you code that if you would like.

Jared
Sep 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by ,hj | last post: by
35 posts views Thread by David Mathog | last post: by
9 posts views Thread by Bert Szoghy | last post: by
4 posts views Thread by Stephen | last post: by
2 posts views Thread by joakim.hove | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.