开发者

Windows Phone 7 WebBrowserTask problem with escaped urls

I'm trying to open a 开发者_运维知识库web page via the instapaper or google mobilizers.

So I pass to the webbrowser task the UrlEncoded url: http://www.instapaper.com/m?u=http%3A%2F%2Ftwitter.com%2FT_Jako%2Fstatuses%2F27119375731400704

which seems perfectly fine to me.

I generate it by doing

serviceUrl + Uri.EscapeDataString(url.ToString())

The problem is IE probably unescapes the parameter before requesting the page, so I get a 404 page.

I don't understand what I am doing wrong, or if it is a bug on WP7 and if there is a workaround for it.

[UPDATE]: This is definitely a bug, that also got confirmed by a guy from the WP7 team. I blogged about that too: http://codeclimber.net.nz/archive/2011/01/19/WP7-Tip-Always-Encode-Urls-for-the-WebBrowserTask.aspx

Thank you Simone


string s = HttpUtility.UrlEncode("http://www.instapaper.com/m?u=http%3A%2F%2Ftwitter.com%2FT_Jako%2Fstatuses%2F27119375731400704");
            WebBrowserTask task = new WebBrowserTask();
            task.URL = s;
            task.Show();

Works for me here.

By the way, if you're using the emulator, you'll likely experience this bug: http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/d00bb0cc-bf8c-4a9e-9823-b55f589a3106/


It's definitely a bug.

I had problems passing Twitter statuses in French. Double escaping the URL worked for me :

string url = http://twitter.com/?status=testÉÇÀéçà
var wb = new WebBrowserTask();
wb.URL = Uri.EscapeUriString(Uri.EscapeUriString(url));
wb.Show();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜