Windows Store App Network communications HttpWebRequest

Source: Internet
Author: User

if you want to better controlHTTPrequest, you can useSystem.Netin the class libraryHttpWebRequestclass, which pairs theHTTPThe protocol is fully encapsulated and provides a lot ofHTTPin the AgreementHeader,Contentand theCookiesThe properties and methods that you set, you can also specify the type of request and the data that is transferred using the stream. HttpWebRequestclass andHttpClientthe use of classes is similar, but there are some differences.

HttpWebRequest Span lang= "en-US" >webrequest httpwebrequest Class common methods and properties.

q   create () httpwebrequest object.

q Getresponseasync () , asynchronously returns the data stream of the response.

q Getrequeststreamasync (), asynchronously gets[J1] used toURIresources that send dataStreamobject.

q   method , Gets or sets the type of the request.

q ContentType , Gets or sets HTTP the value of the header.

UseHttpWebRequestcommunicating with the server, first using theCreatemethod to createHttpWebRequestobject, and then use the Getresponseasyncmethod to the specifiedURIThe resource makes the request and accepts the response data if it needs toURIresources to send data, you can useGetrequeststreamasyncmethod. Here's an example that shows how to use theHttpWebRequestfor network communication.

[J1] is this "asynchronous fetch"?

Windows Store App Network communications HttpWebRequest

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.