I’m using SharpSVN.
I want to store the SVN credential in pc.
I have try to set credentials updating default credentials
using (SvnClient client = new SvnClient())
{
client.Authentication.DefaultCredentials = new System.Net.NetworkCredential("user", "password");
...
}
but it doesn't save the data.
I have found that SharpSvn give a default GUI to input credentials. This GUI has a flag to store the data. Here the links where I found information:
Here the code to use it:
using (SvnClient client = new SvnClient())
{
// Bind the SharpSvn UI to our client for SSL certificate and credentials
SharpSvn.UI.SharpSvnUI.Bind(client, IWin32Window);
....
}
But it is make for Windows.Forms and I use WPF. Also, I couldn't use this default GUI.
Someone now how to do it?
Thanks!!
I found the answer!
For save credentials in the computer in use
using (SvnClient client = new SvnClient())
{
//Save localy new Authentication credentials
client.Authentication.UserNamePasswordHandlers
+= delegate(object obj, SharpSvn.Security.SvnUserNamePasswordEventArgs args)
{
args.UserName = "username";
args.Password = "password";
args.Save= true;
};
}
Frequently I found the solution to add credentials in cache, but this will not store credentials in computer. This credentials are valid only for SvnClient life. I report the answer for completeness
using (SvnClient client = new SvnClient())
{
// Clear a previous authentication
client.Authentication.Clear();
client.Authentication.DefaultCredentials = new System.Net.NetworkCredential("user", "password");
}
I found part of the answer here
And here:
http://sharpsvn.open.collab.net/ds/viewMessage.do?dsMessageId=140680&dsForumId=728
looking at method DialogUserNamePasswordHandler
http://sharpsvn.open.collab.net/svn/sharpsvn/trunk/src/SharpSvn.UI/SvnClientUIHandler.cs
For access use: