本文介绍了与网站一起使用的桌面应用程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以说我有一个用c#编写的Windows窗体应用程序.我想知道如何将该应用程序连接到网站?例如,如何获取< title>网站的任何网站并显示在我的应用程序上?
Lets say I have a windows form application programmed with c#. I want to know how can I connect this application to a website? For example how can I get the <title> of any website and display it on my application?
推荐答案尝试HtmlAgilityPack 会帮到你.. 不要忘记在项目中添加HtmlAgilityPack.dll. try HtmlAgilityPack it will help you.. don''t forgot to add HtmlAgilityPack.dll in your project.
尝试一下: Try this: using System.Xml; using System.Xml.XPath; using System.Xml.Linq; using System.Net; /*...........................*/ HttpWebRequest myReq = ( HttpWebRequest )WebRequest.Create( "www.contoso/" ); myReq.AllowAutoRedirect = true; myReq.MaximumAutomaticRedirections = 5; XNode result; using( var responseStream = myReq.GetResponse( ).GetResponseStream( ) ) { result = XElement.Load( responseStream ); } var title = result.XPathSelectElement( "//title" ).Value;
更多推荐
与网站一起使用的桌面应用程序.
发布评论