469,890 Members | 1,541 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

problem with WebClient.OpenRead

I am trying to use a .Net WebClient object to read data
from a url, but I am getting the following error:

[WebException: The underlying connection was closed: The
server committed an HTTP protocol violation.]
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult
System.Net.WebClient.OpenRead(String address)
WebRequestProto.Client.Button1_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\flare\webrequestproto\client.as px.cs:67
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEve
ntHandler.RaisePostBackEvent(String eventArgument)
(IPostBackEventHandler sourceControl, String eventArgument)
(NameValueCollection postData)
I have no problem accessing this URL directly from
Internet Explorer, or as a Form Action from a standard
html page or a hypertext link from a web page.

It is only a problem when I try using the .Net WebClient
class, and it happens every time.

My code is:
System.Net.WebClient objClient = new System.Net.WebClient

Stream stResponse = objClient.OpenRead

The URL is to a third party application.

Does anyone have any ideas what the problem could be, or
how I can get more information on what the protocol
violation was?

The problem occurs on both Windows 2000 (IIS 5.1) and
Windows 2003(IIS V6).

I have successfully used WebClient in this way to access
other URLs for html files from the same server.



Jul 21 '05 #1
0 1661

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Darryl | last post: by
reply views Thread by JohnBatte | last post: by
7 posts views Thread by Sunny | last post: by
1 post views Thread by yysiow | last post: by
reply views Thread by Helen Abell | last post: by
1 post views Thread by chris.dannemiller | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.