473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

problem with WebClient.OpenRead

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(IAsyncRes ult
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.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)
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

Jul 21 '05 #1
0 1943

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Darryl | last post by:
I'm trying to use the HttpWebRequest class to retrieve XML generated by a jsp page, but an 'The remote server returned an error: (500) Internal Server Error' exception is thrown when I call the...
0
by: JohnBatte | last post by:
I have an UpdateDownloader class I'm working on to download software updates from a file server and report download progress to the user interface. It all works quite well, but I wish I could resume...
7
by: Sunny | last post by:
Hi all, I have found a possible bug in the Uri class constructor. When I make something like this: test = new Uri(@"http://www.test.com/dir1/page1.html"); test2 = new Uri(test,...
1
by: yysiow | last post by:
hi, i using WebClient to get the website. like string URL = "http://127.0.0.1/index.htm"; WebClient client = new WebClient(); Stream data = client.OpenRead(URL); StreamReader reader = new...
0
by: Helen Abell | last post by:
Hi, I am trying to use a .Net WebClient object to read data from a url, but I am getting the following error: System.Net.HttpWebRequest.CheckFinalStatus()...
1
by: chris.dannemiller | last post by:
I have a connection through WebClient running via a thread. Then I call a .OpenRead(). I would like the main thread to be able to cancel this connection. How do I go about it.
2
by: Ezequiel | last post by:
Hi, I´m coding an application that is able to download various mp3 files at the same time. For each mp3 download i´m using a thread. Each thread uses System.net.WebClient. If i try to download 3...
4
by: Harvey Triana | last post by:
Hi- I am using... WebClient Client = new WebClient (); Client.DownloadFile(url, filename); Or Stream strm = Client.OpenRead (url);
0
by: Xavier Mauclaire | last post by:
Hi I've got a piece of code using the webclient object (see below). This function was working until i installed the . Net 3.0 on my computer. This code run withs the version 2.0 of the dotnet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.