与网站一起使用的桌面应用程序.

编程入门 行业动态 更新时间:2024-10-14 08:26:37
本文介绍了与网站一起使用的桌面应用程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可以说我有一个用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;

更多推荐

与网站一起使用的桌面应用程序.

本文发布于:2023-11-23 16:17:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622105.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   桌面   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!