problem: querystring and '&'

  • Thread starter Thread starter Stanley
  • Start date Start date
S

Stanley

dim newQueryString as string = server.UrlEncode(mystring)



-Stanley
 
Hi all,
I am trying to read a parameter value that contains special characters
such as '&' using Request.Querystring. But it does not read the whole string
containing the value. How can I allow the link to pass parameter with
special characters?

Thanks...
-Nikhil
 
<a href="page.aspx?q=<%=Server.UrlEncode("a & b")%>">Click Me</a>

Ray at home
 
Thanks.
I tried your solution. But it did not work. Probably because the
application that opens my ASP.Net page does not support ASP.Net. It needs to
be in HTML/Javascript/VBScript. Please help.

-Nikhil
 
Are you hardcoding this link in a static .htm page then? If so:

<a href="page.aspx?q=a%26b">click me</a>

%26 is the urlencoded & character.

Or, in client side javascript:

<script type="text/javascript">
function goSomewhere() {
var sQString='a&b';
var sHref = 'page.aspx?q=' + escape(sQString);
location.href=sHref;
}
</script>

<button onclick="goSomewhere();">click me</button>

Ray at home
 
server.UrlDecode



-Stanley



Nikhil Patel said:
Hi,
escape function worked for me. Thank you very much. May I ask one more
question. Do I need to use any decoding function in ASPX page to receive the
value?

Thanks...
-Nikhil
 
Hi,
escape function worked for me. Thank you very much. May I ask one more
question. Do I need to use any decoding function in ASPX page to receive the
value?

Thanks...
-Nikhil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top