472,784 Members | 796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 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 1878

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, Im coding an application that is able to download various mp3 files at the same time. For each mp3 download im 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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.