I use WebClient.DownloadData in order to read text from an HTML
document this way:
WebClient c = new WebClient();
string html=
ASCIIEncoding.Default.GetString(c.DownloadData("ht tp://www.test.com"));
When I run the code, I get this error message after a few seconds:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server. at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at System.Net.HttpWebRequest.GetResponse()
at System.Net.WebClient.DownloadData(String address)
at RE.MainForm.Button1Click(Object sender, EventArgs e) in c:\Documents and Settings\Y\My Documents\SharpDevelop
Projects\RE\MainForm.cs:line 93 at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
What can I do to solve it? It worked once and stopped working a few
months ago.
*---------------------------------*
Posted at: http://www.GroupSrv.com
*---------------------------------*
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com