.net - vb UrlEncoding is not working -


hi using below code encoding url in vb not getting expected output please help.

  dim cancelurl string = "http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/login/appointment booking/cancelappointment.aspx?" &                                      "clhid=" & objlogin.loggedheadorgid &                                      "&apptid=" & objappt.id             strtemplatestring = strtemplatestring.replace("[cancellation link]", uri.escapedatastring(cancelurl)) 

this code , ended this

http%3a%2f%2fd41a9833f1464bd0a764b77669049fc8.cloudapp.net%2flogin%2fappointment%20booking%2fcancelappointment.aspx%3fclhid%3d22b53721-a127-41be-95ca-7512b5caad84%26apptid%3debb09af1-c521-47d6-9a7d-0b411ef3937d 

but expecting

http://d41a9833f1464bd0a764b77669049fc8.cloudapp.net/login/appointment booking/cancelappointment.aspx?clhid=3d22b53721-a127-41be-95ca-7512b5caad84&apptid=debb09af1-c521-47d6-9a7d-0b411ef3937d 

you need use uri.escapeuristring not escape scheme:

uri.escapeuristring("http://foo.com/this url")  'output http://foo.com/this%20is%20a%20url 

Comments