HTML敏捷包问题 [英] Problem on HTML agility pack

查看:68
本文介绍了HTML敏捷包问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,亲爱的朋友。我的Html Agility Pack存在严重问题。请看我的代码:



 Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load( https://www.linkedin.com/in/ladan-sahraei-14461b34?authType=OUT_OF_NETWORK&authToken=tK-W&区域设置= EN_US&安培; srchid = 4367283831473659871577&安培; srchindex = 1&安培; srchtotal = 6693647&安培; TRK = vsrp_people_res_name&安培; trkInfo = VSRPsearchId%3A4367283831473659871577%2CVSRPtargetId%3A120972292%2CVSRPcmpt%3Aprimary%2CVSRPnm%3Afalse%2CauthType%3AOUT_OF_NETWORK
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode( // span [@ class ='full-name']
Response.Write(ournone.InnerHtml)





当我运行此代码时我有一个问题:

 对象引用不是 set  to  object 的实例。 

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪 有关错误的更多信息,其中源自代码中的关键字>。





当我在html文件中保存页面内容并再次运行代码时效果很好。



 Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load( http:// localhost:21374 / HtmlPage.html
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode(< span class =code-string> // span [@ class ='full-name']
Response.Write (mynone.InnerHtml)





有什么问题?



我尝试过:


Html Agility Pack上的
问题。请帮帮我

解决方案

亲爱的朋友。我的Html Agility Pack存在严重问题。请查看我的代码:



在系统工作正确但不能使用相同内容在在线网址上运行的第一个代码,并返回空值:



是工作空值!

 Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load( https://www.linkedin.com/in/ladan-sahraei-14461b34?authType= OUT_OF_NETWORK&安培;的authToken = TK-W&安培;语言环境= EN_US&安培; srchid = 4367283831473659871577&安培; srchindex = 1&安培; srchtotal = 6693647&安培; TRK = vsrp_people_res_name&安培; trkInfo = VSRPsearchId%3A4367283831473659871577%2CVSRPtargetId%3A120972292%2CVSRPcmpt%3Aprimary%2CVSRPnm%3Afalse%2CauthType%3AOUT_OF_NETWORK
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode( // span [@ class ='full-name']
Response.Write(ournone.InnerHtml)





是工作正确!

 Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load( http:// localhost :21374 / HtmlPage.html
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode( // span [@ class ='full-name']
Response.Write(ournone.InnerHtml)


hello dear friend. i have a serious problem with Html Agility Pack. please see my code:

Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load("https://www.linkedin.com/in/ladan-sahraei-14461b34?authType=OUT_OF_NETWORK&authToken=tK-W&locale=en_US&srchid=4367283831473659871577&srchindex=1&srchtotal=6693647&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A4367283831473659871577%2CVSRPtargetId%3A120972292%2CVSRPcmpt%3Aprimary%2CVSRPnm%3Afalse%2CauthType%3AOUT_OF_NETWORK")
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode("//span[@class='full-name']")
Response.Write(ournone.InnerHtml)



when i run this code i have a poblem:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 



when i save content of the page in a html file and run code again it work well.

Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load("http://localhost:21374/HtmlPage.html")
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode("//span[@class='full-name']")
Response.Write(ournone.InnerHtml)



what is problem?

What I have tried:

problem on Html Agility Pack. please help me

解决方案

hello dear friend. i have a serious problem with Html Agility Pack. please see my code:

the first code when run on a saved file on system work correct but not work with the same content in a online url and return empty values:

is work empty value!

Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load("https://www.linkedin.com/in/ladan-sahraei-14461b34?authType=OUT_OF_NETWORK&authToken=tK-W&locale=en_US&srchid=4367283831473659871577&srchindex=1&srchtotal=6693647&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A4367283831473659871577%2CVSRPtargetId%3A120972292%2CVSRPcmpt%3Aprimary%2CVSRPnm%3Afalse%2CauthType%3AOUT_OF_NETWORK")
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode("//span[@class='full-name']")
Response.Write(ournone.InnerHtml)



is work correct!

Dim Scr1 As New HtmlWeb()
Dim Url1 = Scr1.Load("http://localhost:21374/HtmlPage.html")
Dim ournone As HtmlNode = Url1.DocumentNode.SelectSingleNode("//span[@class='full-name']")
Response.Write(ournone.InnerHtml)


这篇关于HTML敏捷包问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆