0

My question is the same as Keep url encoded while using URI class but regarding Windows Phone where things work differently.

I have a URL for the payment gate that contains a url encoded part and looks like this

https://api.platebnibrana.csob.cz/api/v1.5/payment/process/M1MIPS0385/a820a587a8350BD/20160420123549/xDMboIwEloc3RPw1hwr22ByqMNyS4QZEkisZDlM%2bembBlET8QtzEfapMxMN8AcnnxqbKV4uEN2iTMg3TbGhcEXmlZJ6a9ZPkL7M7dBr3FkDVc11gg9zjX%2bUd1Ge7BCQtEm0DtNU8sVE%2fX56VvekooHy0T5hidQZrIIGNg1rnz3f2%2fuz1aNc5dVQSTcnfXxNlBRSMbd6kcTmKE04SjB65233ydO%2fowbQE%2fmJuUrc5w0D9YFmlM4zu16SlmDqmdcinenSv4cVkKiXMk8OYANBCJBKegRtFUo303rZRZCUHH5WI1xg55%2fGo%2bFRKV4DsIPBeSMpVf9pEBtZ6YDVMnNKpLg%3d%3d

when I try to create an Uri from it to be used with WebBrowser it changes to

https://api.platebnibrana.csob.cz/api/v1.5/payment/process/M1MIPS0385/a820a587a8350BD/20160420123549/xDMboIwEloc3RPw1hwr22ByqMNyS4QZEkisZDlM+embBlET8QtzEfapMxMN8AcnnxqbKV4uEN2iTMg3TbGhcEXmlZJ6a9ZPkL7M7dBr3FkDVc11gg9zjX+Ud1Ge7BCQtEm0DtNU8sVE/X56VvekooHy0T5hidQZrIIGNg1rnz3f2/uz1aNc5dVQSTcnfXxNlBRSMbd6kcTmKE04SjB65233ydO/owbQE/mJuUrc5w0D9YFmlM4zu16SlmDqmdcinenSv4cVkKiXMk8OYANBCJBKegRtFUo303rZRZCUHH5WI1xg55/Go+FRKV4DsIPBeSMpVf9pEBtZ6YDVMnNKpLg==

which is wrong. According to the mentioned quetsion, the solution is to make a change in the app.config. But there is no app.config in Windows Phone apps.

So is there a way to force Uri not to decode (and screw) the url in Windows Phone?

Community
  • 1
  • 1
Igor Kulman
  • 16,211
  • 10
  • 57
  • 118
  • Is this Windows Phone Silverlight or WinRT? I was not able to reproduce the behavior with the WinRT version. Actually, you can still create `app.config` in the project root and fill it with the value mentioned in http://stackoverflow.com/questions/11034569/keep-url-encoded-while-using-uri-class. – Paulos Apr 20 '16 at 12:25
  • 8.0 so Silverlight. Yes I can add app.config to the project but it does nothing. – Igor Kulman Apr 20 '16 at 12:36
  • Don't forget that this is HTTPS, so you need to change `name="http"` to `name="https"`. – Paulos Apr 20 '16 at 12:38

1 Answers1

2

It is terribble bug in .net see e.g. GETting a URL with an url-encoded slash

When %2f in path is unescaped to /

I found a solution. Try navigate WebBrowser component to string with this body: <html><body><scirpt type="text/javascript">window.location = "url";</script></body></html> where url is your original url.

Community
  • 1
  • 1
Mato Peto
  • 96
  • 3