I'm trying to open this url using a WebBrowserTask in WP7, and it doesn't work (I get a custom error on our website), but when I type it in by hand, it works fine. Any ideas?
It also works perfectly fine in Google Chrome and IE7.
This is the url:
http://www.symfonee.com/Improv/addison/comedians/Bio.aspx?ShowDate=12/15/10&ShowTime=8:00p&Uid=54918a0d-1beb-4552-bdc8-2d474e3ea5ae
And this is my code:
string url = "http://www.symfonee.com/Improv/addison/comedians/Bio.aspx?ShowDate=12/15/10&ShowTime=8:00p&Uid=54918a0d-1beb-4552-bdc8-2d474e3ea5ae";
WebBrowserTask browser = new WebBrowserTask();
browser.URL = url;
browser.Show();
Thanks!
EDIT:
Without any of the solutions below, this code works fine:
WebBrowserTask browser = new WebBrowserTask();
browser.URL = "http://www.youtube.com/results?search_query=Windows+Phone+7&aq=f";
browser.Show();
I don't understand what is different?
There is a bug with the SDK. In URL that contains &
, you need to escape it.
For example:
... Uri.EscapeDataString("&") + "ShowTime=8:00p"
This is most likely because your query string parameters are not URL-encoded. Modern web browsers will attempt to compensate when you paste that into the address bar because it's hard to URL-encode in your head. But when you're using an API, you should really URL-encode those pieces yourself.
Use the Uri.EscapeDataString method to encode each part of the query string individually. For example.
string url = "http://www.symfonee.com/Improv/addison/comedians/Bio.aspx" +
"?ShowDate=" + Uri.EscapeDataString("12/15/10") +
"&ShowTime=" + Uri.EscapeDataString("8:00p") +
"&Uid=" + Uri.EscapeDataString("54918a0d-1beb-4552-bdc8-2d474e3ea5ae");
The following code worked for me:
s = "www.. "; //url
s = Uri.EscapeUriString(s);
task.URL = HttpUtility.UrlEncode(s);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With