SharpSVN 身份验证不影响 TortoiseSVN 凭据

bub*_*ubi 5 c# svn authentication sharpsvn

我想将 SharpSVN 与 TortoiseSVN 的不同用户一起使用。
我使用 VisualSVN 作为服务器,我使用 https 连接到 VisualSVN。在 TortoiseSVN 中,网址是https://<myserver>.
阅读周围我找到了一些可能的解决方案。

client.Authentication.ForceCredentials(user, password);

这最终会更改 TortoiseSVN 缓存,但实际上它是唯一对我有用的身份验证方法。

开头的方法

client.Authentication.Clear();

在这种情况下,当我使用客户端时,我收到错误

无法连接到 URL ' https://myserver '上的存储库
没有为 'svn.ssl.server' 凭据注册的提供程序

小智 0

你应该使用这个代码

client = new SvnClient();
client.Authentication.ForceCredentials(login, password);
client.Authentication.SslServerTrustHandlers += delegate (object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
 {
   e.AcceptedFailures = e.Failures;
   e.Save = true;
 };
Run Code Online (Sandbox Code Playgroud)

  • 欢迎来到堆栈溢出!请不要只用源代码来回答。尝试提供有关您的解决方案如何工作的精彩描述。请参阅:[如何写出一个好的答案?](https://stackoverflow.com/help/how-to-answer)。谢谢 (2认同)