Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I include special characters in query strings?

URL http://localhost/mysite/mypage?param=123 works fine. However, if I want to put some special characters in param, like ?, /, \, then the URL becomes http://localhost/mysite/mypage?param=a=?&b=/ or http://localhost/mysite/mypage?param=http://www.example.com/page2?a=\&b=... which won't work. How do I resolve this issue?

like image 663
KentZhou Avatar asked May 13 '10 15:05

KentZhou


People also ask

How do you pass a symbol in query?

If anybody wants to pass the value from the query string which contains the special symbol like #,@ etc. then we have to use the UrlEncode method of the httpUtility. but if u want the correct value of the querystring then u have to use the UrlEncode.

What characters are allowed in query string?

The query component is a string of information to be interpreted by the resource. Within a query component, the characters ";", "/", "?", ":", "@", "&", "=", "+", ",", and "$" are reserved.

How do I send special characters in HTTP request?

If this is the case and you want to send special characters such as +, /, or = in your HTTP request, your data string must be URL-encoded if you send the data using the PostData or QueryString input elements. If you send the data using the parameters specified on the Configuration tab, encoding is done automatically.


1 Answers

You have to encode special characters in URLs. See: http://www.w3schools.com/tags/ref_urlencode.asp

like image 188
Steven P. Avatar answered Sep 30 '22 20:09

Steven P.