开发者

Where is the "WebClient.UploadString" Method in Windows Phone 7?

开发者 https://www.devze.com 2023-01-16 18:18 出处:网络
I have some old code that I\'m converting to use in Windows Phone. The old code was : private String Post(st开发者_如何学Goring url, string Data)

I have some old code that I'm converting to use in Windows Phone. The old code was :

private String Post(st开发者_如何学Goring url, string Data) { return webClient.UploadString(url, "POST", Data); }

The problem is there isn't a function called UploadString in webClient. Instead, it's the asynchronous one (UploadStringAsync). How can I convert the above old code to immediately return a string response as UploadString used to do ?


You can't. Silverlight doesn't support synchronous network operations. You'll need to refactor your code. There are hacks involving wait handles that may still technically work but relying on them is unwise.

0

精彩评论

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

关注公众号