c# - Encoding parameters for a URL -


i have silverlight application building url. url call rest-based service. service expects single parameter represents location. location in form of "city, state". build url, i'm calling following code:

string url = "http://www.domain.com/myservice.svc/"; url += httputility.urlencode(locationtextbox.text); 

if user enters "chicago, il" locationtextbox, result looks this:

http://www.domain.com/myservice.svc/chicago%2c+il 

in reality though, kind of expecting url like;

http://www.domain.com/myservice.svc/chicago,%20il 

when testing service via browser url, 1 expecting works. however, url being generated not working. doing wrong?

i recommend uri.escapedatastring instead of using httputility functions. see discussion in server.urlencode vs. httputility.urlencode.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -