Maintaining URL encoding for comman (",")

N

N

I am passing URL encoded value in query string and then on server side I
process this query string. There is one situation that is bugging me. The
value from client side can contain "," (commas) and I URL encode the value
and then explictly replace "," with "%2C". So far so good. But when i
retrive this QS param value, "%2C" has already been replaced with ",".

Client side brings the use to the page by setting path on window.location as
follows:

window.location.href= "http://mysite.com?a=1&b=foo,bar,baz

When it comes to server side, the QS param "b" is "foo,bar,baz".

How can i maintian the hex value for "," when it comes to server side.

Thanks
 
S

Steph

N said:
I am passing URL encoded value in query string and then on server side I
process this query string. There is one situation that is bugging me. The
value from client side can contain "," (commas) and I URL encode the value
and then explictly replace "," with "%2C". So far so good. But when i
retrive this QS param value, "%2C" has already been replaced with ",".

Client side brings the use to the page by setting path on window.location as
follows:

window.location.href= "http://mysite.com?a=1&b=foo,bar,baz

When it comes to server side, the QS param "b" is "foo,bar,baz".

How can i maintian the hex value for "," when it comes to server side.

Thanks
why don t simply use :
window.location.href= Server.HTMLEncode(
"http://mysite.com?a=1&b=foo,bar,baz");

and after : Request["b"].ToString();
and in black case... Server.HTMLDecode( Request["b"].ToString() );
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top