0

I have read all the answers on this topic here. It just does not solve my problem.

Every time I try to connect to the following server I get this Exception:

System.Net.WebException: Der Server hat eine Protokollverletzung ausgeführt. Section=ResponseStatusLine bei System.Net.HttpWebRequest.GetResponse()

This is my code:

string Url = "http://hbci01.fiducia.de:3000";
string Message = "HBCI-Message";

var req = WebRequest.Create(Url) as HttpWebRequest;

byte[] data = Encoding.ASCII.GetBytes(Helper.EncodeTo64(Message));

req.Method = "POST";
req.Timeout = 10000;
req.ContentType = "application/octet-stream";
req.ContentLength = data.Length;
req.KeepAlive = false;

req.ServicePoint.Expect100Continue = true;

req.UserAgent = "User-Agent";

req.Headers.Add("Header", "Header");

using (Stream reqStream = req.GetRequestStream())
{
    reqStream.Write(data, 0, data.Length);
    reqStream.Flush();
}

And yes, the server is listening on port 3000.

Does anyone have a solution?

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62

1 Answers1

1

Replace the remote server with one that actually speaks non-corrupted HTTP.

spender
  • 117,338
  • 33
  • 229
  • 351
  • It is a third party server from a german bank data center. I dont think they will replace it for me. – mrklintscher Feb 09 '17 at 08:53
  • That URL doesn't even load, so yes - I can confirm this answer, while it may not look like it, is indeed correct. – Manfred Radlwimmer Feb 09 '17 at 08:54
  • @mrklintscher Maybe they use some sort of white-listing and don't want you/us to access that url? – Manfred Radlwimmer Feb 09 '17 at 08:54
  • 1
    Are you sure the remote end is expecting HTTP? If so, your only recourse is to report the fault (or switch to socket-level comms to attempt to speak corrupt HTTP to it) – spender Feb 09 '17 at 08:54
  • @ManfredRadlwimmer no this can not be. – mrklintscher Feb 09 '17 at 08:55
  • Try connecting via RAW TCP or fire up WireShark to get to the root of this problem. As it is now, spender is correct - the server doesn't speak (non-corrupted) HTTP so there is nothing that can be done with your current code. – Manfred Radlwimmer Feb 09 '17 at 08:57
  • @spender This is the server configuration: access data User identification: according to INI letter URL / IP address: hbci01.fiducia.de Customer ID: No entry for Raiffeisenbank accounts HBCI version: 3.0 Port: 3000 – mrklintscher Feb 09 '17 at 08:58
  • @ManfredRadlwimmer Do you have a solution for me? Maybe a code snippet? – mrklintscher Feb 09 '17 at 08:58
  • @spender ***... or switch to socket-level comms to attempt to speak corrupt HTTP to it*** Do have a code snippet for that? – mrklintscher Feb 09 '17 at 09:06
  • As I said before, this probably isn't something that can be solved with your current code. You first need to find out what the problem is. Does the server even expect HTTP? Does the server allow access to it's root path? According to [the banks homepage](https://www.raibank.de/privatkunden/girokonto-kreditkarten/infos-banking/zugangsverfahren.html#tab=reiter_-1596325141) the server and port should be correct, but maybe that's not all there is to it. – Manfred Radlwimmer Feb 09 '17 at 09:08
  • 1
    @mrklintscher Pick up the phone. Have a chat with them. I'm sure they'd love to help you out. – spender Feb 09 '17 at 09:10
  • 1
    @mrklintscher http://stackoverflow.com/questions/19523088/create-http-request-using-tcpclient Good luck. – spender Feb 09 '17 at 09:14
  • @spender Sorry but it is a non working code ... Its throws only System.ArgumentOutOfRangeException: The index and the number must refer to a position in the buffer. – mrklintscher Feb 09 '17 at 09:21
  • @mrklintscher Ok. This is now a [chameleon question](http://meta.stackexchange.com/questions/43478/exit-strategies-for-chameleon-questions). I suggest the following search terms in your favorite search engine "TcpClient HTTP c#". Feel free to open another question when you run into problems. – spender Feb 09 '17 at 09:24
  • @spender because it runs in a protocol violence too ... And this is why i ask my question bro. – mrklintscher Feb 09 '17 at 09:27