HttpRequest (well known by now..) error

O

objectref

Hi,

does anybody have found a working solution for this HttpRequest error :
"ServerProtocolViolation/The server committed a protocol violation.
Section=ResponseStatusLine"

i tried the solution regarding the app.config file, by puting there the
following

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
</configuration>

on the client (and the server that is runnign an http server software)
but i keep getting the same message...


Thanks a lot for any help
 
N

Nicholas Paldino [.NET/C# MVP]

The documentation for the UseUnsafeHeaderParsing property on the
HttpWebRequestElement states the following:

Header names cannot have non-ASCII chars in them. This validation is
performed whether this property is set to true or false.

I'm assuming that this is the problem that you are facing. It's really
an error on the server's part, and that is the area where it should be
fixed.

You might have to resort to parsing the headers/etc, etc yourself.
Either that, or use another third party provider (perhaps IP works).

Hope this helps.
 
O

objectref

Thanks for the reply!

I initialize a stream writer on the server part to write something on the
socet that took the http request.
You mean that is something there that is not correct ?


Thanks again..



Nicholas Paldino said:
The documentation for the UseUnsafeHeaderParsing property on the
HttpWebRequestElement states the following:

Header names cannot have non-ASCII chars in them. This validation is
performed whether this property is set to true or false.

I'm assuming that this is the problem that you are facing. It's really
an error on the server's part, and that is the area where it should be
fixed.

You might have to resort to parsing the headers/etc, etc yourself.
Either that, or use another third party provider (perhaps IP works).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

objectref said:
Hi,

does anybody have found a working solution for this HttpRequest error :
"ServerProtocolViolation/The server committed a protocol violation.
Section=ResponseStatusLine"

i tried the solution regarding the app.config file, by puting there the
following

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
</configuration>

on the client (and the server that is runnign an http server software)
but i keep getting the same message...


Thanks a lot for any help
 
J

Jesse Houwing

objectref said:
Thanks for the reply!

I initialize a stream writer on the server part to write something on the
socet that took the http request.
You mean that is something there that is not correct ?


Thanks again..

Yes, that is probably what is happening.

I some time ago I needed to connect to a web service that returned no
headers at all, just the content. I ended up writing a HTTP request
directly to a tcp connection and reading the results. The
HttpRequest/Response classes in .Net are *very* strict when it comes to
the actual protocol.

You should not that the HTTP protocol is quite complex. The easiest
solution is to host your application in IIS as an ASP.net application so
that it can offload all the protocol stuff from you. But if that is not
possible, then have a look at the System.Net.HttpListener class instead
of rolling your own solution on the server side.

Kind regards,

Jesse Houwing
Nicholas Paldino said:
The documentation for the UseUnsafeHeaderParsing property on the
HttpWebRequestElement states the following:

Header names cannot have non-ASCII chars in them. This validation is
performed whether this property is set to true or false.

I'm assuming that this is the problem that you are facing. It's really
an error on the server's part, and that is the area where it should be
fixed.

You might have to resort to parsing the headers/etc, etc yourself.
Either that, or use another third party provider (perhaps IP works).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

objectref said:
Hi,

does anybody have found a working solution for this HttpRequest error :
"ServerProtocolViolation/The server committed a protocol violation.
Section=ResponseStatusLine"

i tried the solution regarding the app.config file, by puting there the
following

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
</configuration>

on the client (and the server that is runnign an http server software)
but i keep getting the same message...


Thanks a lot for any help
 
O

objectref

Hey Jesse,

thanks for the help!

The funny thing is that the app is relatevely simple and it is
a clasic windows applicatio.
Socket opens, send data and receive data, just like you describe.


objectref


Jesse Houwing said:
objectref said:
Thanks for the reply!

I initialize a stream writer on the server part to write something on the
socet that took the http request.
You mean that is something there that is not correct ?


Thanks again..

Yes, that is probably what is happening.

I some time ago I needed to connect to a web service that returned no
headers at all, just the content. I ended up writing a HTTP request
directly to a tcp connection and reading the results. The
HttpRequest/Response classes in .Net are *very* strict when it comes to
the actual protocol.

You should not that the HTTP protocol is quite complex. The easiest
solution is to host your application in IIS as an ASP.net application so
that it can offload all the protocol stuff from you. But if that is not
possible, then have a look at the System.Net.HttpListener class instead of
rolling your own solution on the server side.

Kind regards,

Jesse Houwing
Nicholas Paldino said:
The documentation for the UseUnsafeHeaderParsing property on the
HttpWebRequestElement states the following:

Header names cannot have non-ASCII chars in them. This validation is
performed whether this property is set to true or false.

I'm assuming that this is the problem that you are facing. It's
really an error on the server's part, and that is the area where it
should be fixed.

You might have to resort to parsing the headers/etc, etc yourself.
Either that, or use another third party provider (perhaps IP works).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

does anybody have found a working solution for this HttpRequest error :
"ServerProtocolViolation/The server committed a protocol violation.
Section=ResponseStatusLine"

i tried the solution regarding the app.config file, by puting there the
following

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
</configuration>

on the client (and the server that is runnign an http server software)
but i keep getting the same message...


Thanks a lot for any help
 

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

Top