How Windows Phone Network requests Compare

Source: Internet
Author: User

The current Windows Phone platform supports the following ways to implement network requests: HttpWebRequest, WebClient, WebBrowser, Socket

I personally give them a class:

Most practical, most troublesome: HttpWebRequest

Most Concise: WebClient

Most wretched: WebBrowser

Most infrequently used: Socket

Possible use of some WP source case: http://code.662p.com/list/14_1.html

1.HttpWebRequest:

can achieve a variety of WP support request type (currently support Post/get), support cookies, support complex post protocol, the definition is very free, but the process is more cumbersome, the rules are the most, a little careless will go wrong, but the implementation of efficiency also with the best one


2.WebClient:

Compared to HttpWebRequest, it does not support cookies first, but the amount of code is small, a simple request may only require a few lines of code, and HttpWebRequest need more code, and less control than HttpWebRequest, Sometimes there are some inexplicable errors, but compared to HttpWebRequest is indeed a lot simpler, when appropriate, the use of WebClient can effectively improve development efficiency, reduce the complexity of the code.


3.WebBrowser:

Why is that so wretched? This stems from a development experience, because WP does not support the GB2312 character set, there are many pages are GB2312, and at that time we do not have a server, only on the client to the HTML processing, crawling the required content, and then the other groups all stuck in the GB2312 transcoding work, At this time I found WebBrowser, it can be used to send get requests, but also support JavaScript, and no matter what encoding, ie can give you normal transcoding, you just need to call the relevant method after the request to the content to extract the HTML string, compared to the previous two, are convenient and concise ... This is simply too wretched!

Detailed Description: http://wp.662p.com/thread-8099-1-1.html

How Windows Phone Network requests Compare

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.