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