0

Alright, I am using the following code:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += (send, cert, chain, sslPolicyErrors) => true;
string dlclresponse =  "";
try
{
    WebRequest wr = WebRequest.Create(url);
    Stream stream = wr.GetResponse().GetResponseStream();
    Debug.WriteLine("HTTPDEBUG:" + " Success");
    dlclresponse = new StreamReader(stream).ReadToEnd();
}
catch (WebException we)
{
    var ex = we as Exception;

    while (ex != null)
    {
        Debug.WriteLine("HTTPDEBUG:" + ex.ToString());
        ex = ex.InnerException;
    }
}

I am fully aware that this just neglects the security behind ssl, but I just can't seem to get this working on my Ubuntu server using mono.

The url that isn't working is the following:

https://atarashii.toshocat.com/2.1/anime/schedule

It keeps giving me this exception:

System.Net.WebException: Error: SendFailure (Error writing headers) ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.

I've read quit a bunch but honestly I don't understand much of it.

What am I doing wrong? Most of the answers found to this solution is something like the above, but it just keeps crashing. I tried multiple about everything from here:

Mono https webrequest fails with "The authentication or decryption has failed"

But none seemed to do anything ;(.

At the moment I am really lurking to use that curl hack since this just feels unsolvable at the moment.

I hope maybe one of you might have another idea which could help me out.

Thanks in advance!

1 Answers1

0

Ok, stupid me. I actually had an older version of mono, 4.2.1.102 in fact. Which just didn't want to work with me. Removing that and updating to the latest version fixed it ;/. Bye bye hours wasted on finding the ultimate: did you reinstall it fix.