How to suppress javascript error while using WebClient
-
Hi I am using the following code to retrieve an HTML page contents but it is throwing an exception for certain page of javascript type. Following is the code used to retrieve the page.
Dim objWebClient As New WebClient() Dim objUTF8 As New System.Text.UTF8Encoding() Dim strRequestHTML As String strRequestHTML = objUTF8.GetString(objWebClient.DownloadData(New Uri("http://search.live.com/results.aspx?q=basic")))
Here the error is thrown while downloading the data that an unspecified error occurred at line #. I want to suppress this error, please suggest me any mod which could do the trick. I would be so thankful to you. Thanks and Regards,
MAP Tiger Tiger Softwares Software Designer and Developer VB.NET, ASP.NET, VFP
-
Hi I am using the following code to retrieve an HTML page contents but it is throwing an exception for certain page of javascript type. Following is the code used to retrieve the page.
Dim objWebClient As New WebClient() Dim objUTF8 As New System.Text.UTF8Encoding() Dim strRequestHTML As String strRequestHTML = objUTF8.GetString(objWebClient.DownloadData(New Uri("http://search.live.com/results.aspx?q=basic")))
Here the error is thrown while downloading the data that an unspecified error occurred at line #. I want to suppress this error, please suggest me any mod which could do the trick. I would be so thankful to you. Thanks and Regards,
MAP Tiger Tiger Softwares Software Designer and Developer VB.NET, ASP.NET, VFP
Try to supply request headers as a valid JS supported browser. This may avoid JS errors. I don't think that you can suppress it.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Try to supply request headers as a valid JS supported browser. This may avoid JS errors. I don't think that you can suppress it.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Hi I am using the following code to retrieve an HTML page contents but it is throwing an exception for certain page of javascript type. Following is the code used to retrieve the page.
Dim objWebClient As New WebClient() Dim objUTF8 As New System.Text.UTF8Encoding() Dim strRequestHTML As String strRequestHTML = objUTF8.GetString(objWebClient.DownloadData(New Uri("http://search.live.com/results.aspx?q=basic")))
Here the error is thrown while downloading the data that an unspecified error occurred at line #. I want to suppress this error, please suggest me any mod which could do the trick. I would be so thankful to you. Thanks and Regards,
MAP Tiger Tiger Softwares Software Designer and Developer VB.NET, ASP.NET, VFP
Hi guys I just have analyzed that the problem is not in this procedure but the upcoming syntaxes are throwing the error:
Dim aDoc As IHTMLDocument2 = New HTMLDocumentClass() aDoc.write(strRequestHTML) aDoc.close()
I am using this procedure to access all the elements of the downloaded HTML page and the error throws at
aDoc.write(strRequestHTML)
and I think it is because there are javascripts which are supposed to be loaded but the current implementation is not letting it loaded so the functions which are using them are of course left undefined which in turn throwing the error. Please help me in this regard, I would be so thankful. Regards,MAP Tiger Tiger Softwares Software Designer and Developer VB.NET, ASP.NET, VFP
-
Hi guys I just have analyzed that the problem is not in this procedure but the upcoming syntaxes are throwing the error:
Dim aDoc As IHTMLDocument2 = New HTMLDocumentClass() aDoc.write(strRequestHTML) aDoc.close()
I am using this procedure to access all the elements of the downloaded HTML page and the error throws at
aDoc.write(strRequestHTML)
and I think it is because there are javascripts which are supposed to be loaded but the current implementation is not letting it loaded so the functions which are using them are of course left undefined which in turn throwing the error. Please help me in this regard, I would be so thankful. Regards,MAP Tiger Tiger Softwares Software Designer and Developer VB.NET, ASP.NET, VFP
since you have the string you can prepend to it: <script language="JavaScript" type="text/javascript"> <!-- function stoperror(){return true} window.onerror=stoperror // --> </script> This will suppress the javascript errors, if that is what is causing the problem.