Here is a snippet in C# that I extracted from a project on GotDotNet,
showing you how to do this using a .NET object, instead of a COM component.
This was extracted from
http://www.gotdotnet.com/Community/U...5-ED43CC83A68C
SiteMap 1.1 HTML Page Scraper (PageScanner.cs)
Hope this helps,
--- Nick
HttpWebRequest request;
HttpWebResponse response;
request = (HttpWebRequest)WebRequest.Create( url );
// *** BLOCK THREAD ***
response = (HttpWebResponse)request.GetResponse();
try {
// Read the response into a Stream object.
Stream responseStream = response.GetResponseStream();
if( responseStream == null ) {
throw new ApplicationException( "Server sent empty response stream
for "+url );
}
StreamReader reader=null;
try{
reader = new StreamReader( responseStream,
System.Text.Encoding.Default );
// *** BLOCK THREAD *** - until whole stream is read.
htmlText = reader.ReadToEnd(); // read in the web page
} catch( System.ArgumentOutOfRangeException ex) {
// this resolves back to the StreamReader having a byteCount of <
0 for its input buffer
// is caused by the connection failing with this exception in the
response
//IOException: Unable to read data from the transport connection
// Maybe the TcpConnect in just failed?
// anyway retry
throw ex;
} catch(Exception ex ) {
throw ex;
} finally{
if( reader != null ) reader.Close(); // manual clean up required or
will run out of WebHttp resources
}
} catch(Exception ex ) {
throw ex;
} finally{
response.Close(); // Release the HttpWebResponse resource. if we fail
to do this we may run out of connections
}
"kajol" <ka***@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com...
Hi everyone
I am trying to get the content of any webpage (URL) using XMLHTTP, and
it is working fine for me, but suddenly I have got
a URL "http://www.bizrate.com/" which is causing a system error and the
error is
System.Runtime.InteropServices.COMException(0xC00C E56E): System error:-
1072896658
here is the code, which I am using to get the content
''''''''''''''''''''''''''''''''''''''''''''''
Dim a As Object
a = CreateObject("Microsoft.XMLHTTP")
a.open("GET","http://www.bizrate.com/",False)
a.Send("")
TextBox1.Text = a.ResponseText
''''''''''''''''''''''''''''''''''''''''''''''
Can anybody help me to solve this problem, I have tried it using VB6 also,
and VB6 is also showing the same error.
One more thing I want to say about this, is that, I have got the content
of the URL "http://www.bizrate.com/" by typing the
address into the addressbar of the browser (IE), and got the HTML from
view->source, and then saved the HTML into my
localhost and changed the URL by "http://localhost/testpage.html and the
application worked for me, but it is not working
when the URL is used with XMLHTTP
Kajol