Objects in the Windows runtime that support access to network resources: HttpWebRequest objects
Send Get/post request, Httphelper package, timeout control.
HttpClient Object
Send Get/post request, request Progress Monitor.
Two common request types: GET Requests
The main request for data from the server
Can pass Limited (1024 bytes) of data
POST Request
The main is to send data to the server, there is no limit to the size of data transfer.
You can also receive server-side data, but most of the request results are identified.
HttpWebRequest
1 < Grid > 2 < WebView 3 x:name = "WebView" /> 4 </ Grid >
1 protected Async Override voidonnavigatedto (NavigationEventArgs e)2 {3 //Create Request Object4HttpWebRequest request = Webrequest.createhttp ("http://www.baidu.com");5 //Set Request Parameters6Request. Accept ="*/*";7Request. Method ="GET";8Request. headers["Cookies"] ="Key1=value;key2=val";//Password Storage area9 //send a request to get the service-side responseTen varResponse =awaitrequest. Getresponseasync (); One using(varstream =Response. GetResponseStream ()) A { - using(varReader =NewStreamReader (stream)) - { the varresult =awaitReader. Readtoendasync (); - webview.navigatetostring (result); - } - } +}
Windows Phone 15, HttpWebRequest