473,473 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HTTP request & HTTP protocol violation

Hi,

I am trying to read some industrial webservers using the HTTP/CGI webequest
like this:

wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string);
mwst = (HttpWebResponse wrs.GetResponse();
str = mwst.GetResponseStream();

This usually works fine but on some servers i get:
"System.Net.WebException: The underlying connection was closed: The server
committed an HTTP protocol violation."

The same request works fine in IE and basically i just want whatever comes
from the server to parse it...

So how can i get around this http protocol violation and stille get the data
from the server ? - Is there some alternative (- and less sensitive) way to
do a CGi request ?

--
Henrik Hansen
Nov 16 '05 #1
5 6009
When you say it works from a browser - are you doing a post or a get
request. Try forcing a post request through and see if that works from the
net code.

Also, I assume that this (HTTP/CGI-string) is a quoted address string as its
not in your example.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Henrik" <He****@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hi,

I am trying to read some industrial webservers using the HTTP/CGI webequest like this:

wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string);
mwst = (HttpWebResponse wrs.GetResponse();
str = mwst.GetResponseStream();

This usually works fine but on some servers i get:
"System.Net.WebException: The underlying connection was closed: The server
committed an HTTP protocol violation."

The same request works fine in IE and basically i just want whatever comes
from the server to parse it...

So how can i get around this http protocol violation and stille get the data from the server ? - Is there some alternative (- and less sensitive) way to do a CGi request ?

--
Henrik Hansen

Nov 16 '05 #2
The http request is a string like "http://IP/cgi/command.cgi?blablabla" and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebException: The operation has timed-out.

/henrik

"John Timney (ASP.NET MVP)" wrote:
When you say it works from a browser - are you doing a post or a get
request. Try forcing a post request through and see if that works from the
net code.

Also, I assume that this (HTTP/CGI-string) is a quoted address string as its
not in your example.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Henrik" <He****@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hi,

I am trying to read some industrial webservers using the HTTP/CGI

webequest
like this:

wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string);
mwst = (HttpWebResponse wrs.GetResponse();
str = mwst.GetResponseStream();

This usually works fine but on some servers i get:
"System.Net.WebException: The underlying connection was closed: The server
committed an HTTP protocol violation."

The same request works fine in IE and basically i just want whatever comes
from the server to parse it...

So how can i get around this http protocol violation and stille get the

data
from the server ? - Is there some alternative (- and less sensitive) way

to
do a CGi request ?

--
Henrik Hansen


Nov 16 '05 #3
Henrik,

Are there cookies perhaps on the browser that are being passed to the
server? Also, does the server do anything based on the user agent string
that is sent to the server? Do you have to set up a proxy for the browser
(which would indicate you have to set up a proxy for the WebRequest as
well)?

The server can do a number of things, based on a number of different
parameters other than just the URL string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Henrik" <He****@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
The http request is a string like "http://IP/cgi/command.cgi?blablabla"
and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebException: The operation has timed-out.

/henrik

"John Timney (ASP.NET MVP)" wrote:
When you say it works from a browser - are you doing a post or a get
request. Try forcing a post request through and see if that works from
the
net code.

Also, I assume that this (HTTP/CGI-string) is a quoted address string as
its
not in your example.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Henrik" <He****@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
> Hi,
>
> I am trying to read some industrial webservers using the HTTP/CGI

webequest
> like this:
>
> wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string);
> mwst = (HttpWebResponse wrs.GetResponse();
> str = mwst.GetResponseStream();
>
> This usually works fine but on some servers i get:
> "System.Net.WebException: The underlying connection was closed: The
> server
> committed an HTTP protocol violation."
>
> The same request works fine in IE and basically i just want whatever
> comes
> from the server to parse it...
>
> So how can i get around this http protocol violation and stille get the

data
> from the server ? - Is there some alternative (- and less sensitive)
> way

to
> do a CGi request ?
>
> --
> Henrik Hansen


Nov 16 '05 #4
Since it is a GET requset i want, i belive this was a wrong track....
/henrik

"Joerg Jooss" wrote:
Henrik wrote:
The http request is a string like
"http://IP/cgi/command.cgi?blablabla" and as said it works fine in a
browser...

When i add the POST method i just get this:
System.Net.WebException: The operation has timed-out.


You cannot just simply change the method to POST. Posting requires data
being written to the request stream. If not, the operation will time out, as
you've seen.
Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 16 '05 #5
Hi Nicholas,

We do not use any proxy servers and i can get other information from the
same device using other http requests (Also from .NET/C#). And i dont believe
that any coockies is involved. I have tried to monitor the TCP flow using the
MS Network monitor and nothing seems to be differentin the TCP flow except
from the fact that the .NET http request simply stops due to the violation
error.

So still i believe that the .NET request is too sensitive and i "just" want
a way to collect the raw stream from the device...

/henrik

"Nicholas Paldino [.NET/C# MVP]" wrote:
Henrik,

Are there cookies perhaps on the browser that are being passed to the
server? Also, does the server do anything based on the user agent string
that is sent to the server? Do you have to set up a proxy for the browser
(which would indicate you have to set up a proxy for the WebRequest as
well)?

The server can do a number of things, based on a number of different
parameters other than just the URL string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Henrik" <He****@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
The http request is a string like "http://IP/cgi/command.cgi?blablabla"
and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebException: The operation has timed-out.

/henrik

"John Timney (ASP.NET MVP)" wrote:
When you say it works from a browser - are you doing a post or a get
request. Try forcing a post request through and see if that works from
the
net code.

Also, I assume that this (HTTP/CGI-string) is a quoted address string as
its
not in your example.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Henrik" <He****@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
> Hi,
>
> I am trying to read some industrial webservers using the HTTP/CGI
webequest
> like this:
>
> wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string);
> mwst = (HttpWebResponse wrs.GetResponse();
> str = mwst.GetResponseStream();
>
> This usually works fine but on some servers i get:
> "System.Net.WebException: The underlying connection was closed: The
> server
> committed an HTTP protocol violation."
>
> The same request works fine in IE and basically i just want whatever
> comes
> from the server to parse it...
>
> So how can i get around this http protocol violation and stille get the
data
> from the server ? - Is there some alternative (- and less sensitive)
> way
to
> do a CGi request ?
>
> --
> Henrik Hansen


Nov 16 '05 #6

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

Similar topics

8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
4
by: Justin Malloy | last post by:
I am using the System.Net.Webclient to try and download an XML file from a website but am receiving a HTTP protocol error when running the DownloadFile() sub routine. I did a HTTP trace using...
3
by: sumit | last post by:
Hi, I am trying to send an XML request from ASPX page to A servlet,,,and gets the XML response back. I am using HttpWebRequest object. It throws exception as: The underlying connection was...
0
by: Dan W. | last post by:
Does anyone have any experience with this problem. I am trying to post about 20 fields of information to another server using System.Net.WebClient.UploadData. This works fine for some servers but...
1
by: Dan W. | last post by:
Does anyone have any experience with this problem. I am trying to post about 20 fields of information to another server using System.Net.WebClient.UploadData. This works fine for some servers but...
1
by: Khadim | last post by:
I m using HTTWebResponse which is running smoothly on my system which is behing a proxy server. When I run the application with Live IP it gives "HTTP Protocol violation error" I can't use...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
0
by: Marcus Ogden | last post by:
Hello, A client of ours using the Squid proxy server (version 2.5.STABLE6-3.4E.12.1) on Red Hat Enterprise Linux 4 is experiencing a problem when running our .NET 2.0 client application, which...
0
by: Jayson | last post by:
Hi all. I'm trying to retrieve informations from a Java web service. I've generated a proxy class, using Web Matrix, starting from the wsdl, including it in a project developed with VS2003...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
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...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.