473,735 Members | 4,844 Online
Bytes | Software Development & Data Engineering Community
+ 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.Cre ate(HTTP/CGI-string);
mwst = (HttpWebRespons e wrs.GetResponse ();
str = mwst.GetRespons eStream();

This usually works fine but on some servers i get:
"System.Net.Web Exception: 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 6022
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****@discuss ions.microsoft. com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
Hi,

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

wrs = (HttpWebRequest )WebRequest.Cre ate(HTTP/CGI-string);
mwst = (HttpWebRespons e wrs.GetResponse ();
str = mwst.GetRespons eStream();

This usually works fine but on some servers i get:
"System.Net.Web Exception: 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?bla blabla" and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebE xception: 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****@discuss ions.microsoft. com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
Hi,

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

webequest
like this:

wrs = (HttpWebRequest )WebRequest.Cre ate(HTTP/CGI-string);
mwst = (HttpWebRespons e wrs.GetResponse ();
str = mwst.GetRespons eStream();

This usually works fine but on some servers i get:
"System.Net.Web Exception: 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.co m
"Henrik" <He****@discuss ions.microsoft. com> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
The http request is a string like "http://IP/cgi/command.cgi?bla blabla"
and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebE xception: 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****@discuss ions.microsoft. com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
> Hi,
>
> I am trying to read some industrial webservers using the HTTP/CGI

webequest
> like this:
>
> wrs = (HttpWebRequest )WebRequest.Cre ate(HTTP/CGI-string);
> mwst = (HttpWebRespons e wrs.GetResponse ();
> str = mwst.GetRespons eStream();
>
> This usually works fine but on some servers i get:
> "System.Net.Web Exception: 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?bla blabla" and as said it works fine in a
browser...

When i add the POST method i just get this:
System.Net.WebE xception: 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.co m
"Henrik" <He****@discuss ions.microsoft. com> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
The http request is a string like "http://IP/cgi/command.cgi?bla blabla"
and
as said it works fine in a browser...

When i add the POST method i just get this:
System.Net.WebE xception: 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****@discuss ions.microsoft. com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
> Hi,
>
> I am trying to read some industrial webservers using the HTTP/CGI
webequest
> like this:
>
> wrs = (HttpWebRequest )WebRequest.Cre ate(HTTP/CGI-string);
> mwst = (HttpWebRespons e wrs.GetResponse ();
> str = mwst.GetRespons eStream();
>
> This usually works fine but on some servers i get:
> "System.Net.Web Exception: 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
10648
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 Request" was the original error msg now that I reinstalled iislockdown and urscan I get "The parameter is incorrect." If I use the get method with this form it works just fine on everything. I can't say for certain but I think this problem started...
4
15528
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 internet explorer to see what is happening in the request and it looks as though the request originates using HTTP/1.1 to an IIS server authenticates itself but ultimately gets executed by a Java Application server and when the request is fulfilled...
3
1510
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 closed: The server committed an HTTP protocol violation. Previously it was working fine but suddenly it has given error like this,,,,and sometimes this error comes but
0
1534
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 one in particular is causing the exception "The underlying connection was closed: The server committed an HTTP protocol violation" to be thrown. I found a post that said to add a config file with the following.... <configuration>...
1
7769
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 one in particular is causing the exception "The underlying connection was closed: The server committed an HTTP protocol violation" to be thrown. I found a post that said to add a config file with the following.... <configuration>...
1
2410
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 'useUnsafeHeaderParsing' because it is not recognized by framework without sp3. I have urlencoded my data... its a simple get method with no complexity
3
4926
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 one post for every 10 seconds the client start getting error 403 'forbidden' from the webserver after a short period of time. The webserver is IIS. The choking of the client/server communication when doing high frequency posting is due to that we...
0
1995
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 communicates with a .NET 2.0 web service on our server. When our client application sends an HTTP 1.1 request through the Squid proxy to our server, it receives the error:
0
1314
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 (vb.net) and Framework 1.1.4322.2032. We have put this application in a shared folder to let some clients use it from various location, but even if it works fine from the
0
8959
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9324
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9248
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9197
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6747
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4556
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4821
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.