WebClient - HTTP Protocol Violation

H

Helen

Hi,
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.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult
asyncResult)
System.Net.HttpWebRequest.GetResponse()
System.Net.WebClient.OpenRead(String address)
WebRequestProto.Client.Button1_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\flare\webrequestproto\client.aspx.cs:67
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve
ntHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()


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
("http://2k3btest/SculptorWeb/nph-srep.exe?
SCPROG=aub.q&ID=1");

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.

Thanks

Helen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top