I`m trying to print out log messages from our sub version. But I'm struggling with bypassing the invalid SSL certificate. This is the error:
OPTIONS of 'https://xxxxx/svn/SiteFabrics/trunk/AppLaunch/Bloc/Frontend': Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted (https://xxxx)
My attempt of ignoring the certificate error was to add this line:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
However that didn't make any difference as the .net error is still the same. Below is the code, can anyone see what I am doing wrong?
using (SvnClient client = new SvnClient())
{
Collection<SvnLogEventArgs> list;
client.Authentication.DefaultCredentials = new NetworkCredential("user", "pass");
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
SvnLogArgs la = new SvnLogArgs(); //{ Start=128; End=132; };
client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true);
client.GetLog(new Uri("https://[svnurl]"), la, out list);
ViewBag.SVNLog = list;
}
Disable Chrome Checking All SSL Certificates If you're on Windows simply right-click into the properties of the launcher. Then add --ignore-certificate-errors in the target field. Then restart Chrome.
An SSL certificate error occurs when the browser cannot verify the SSL certificates returned by the server. When the error happens, the browser blocks the website and warns the user that the website cannot be trusted as shown below. These warnings will negatively impact the user's trust in your website.
FOUND THE SOLUTION TO THIS PROBLEM:
First add this:
static void SVN_SSL_Override(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
e.AcceptedFailures = e.Failures;
e.Save = true;
}
and then replace my original magic line:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
with this:
client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(SVN_SSL_Override);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With