获取Metro风格应用中的网页内容 [英] Get web page contents in Metro style app
本文介绍了获取Metro风格应用中的网页内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个地铁风格的应用程序,我需要从互联网资源获得回复
在win form app:
im creating a metro style app and i need to get response from internet resource
in win form app:
// Create the web request
HttpWebRequest request = WebRequest.Create("https://abc.com/") as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
但在Metro风格应用请求中没有 GetResponse()方法
谢谢。
but in Metro style app request dont have GetResponse() method
Thanks.
推荐答案
希望这会有所帮助..
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx [ ^ ]
Hope this helps..
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx[^]
using System.Net;
//Web Request
HttpWebRequest Imgrequest = (HttpWebRequest)WebRequest.Create("web address");
NetworkCredential credential = new NetworkCredential("username", "password", "domain");
Imgrequest.Credentials = credential; //If authentication required for the web address
//Web Response
HttpWebResponse webresponse = (HttpWebResponse)await Imgrequest.GetResponseAsync();
var stream = webresponse.GetResponseStream();
谢谢,
Bilaal
Thanks,
Bilaal
这篇关于获取Metro风格应用中的网页内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文