Support for WebDav with domain users

This commit is contained in:
Philipp Crocoll 2013-07-11 22:03:29 +02:00
parent deeaa673a5
commit 43ea197fd5

View File

@ -193,7 +193,20 @@ namespace KeePassLib.Serialization
if ((ioc.UserName.Length > 0) || (ioc.Password.Length > 0))
{
//set the credentials without a cache (in case the cache below fails:
wc.Credentials = new NetworkCredential(ioc.UserName, ioc.Password);
//check for backslash to determine whether we need to specify the domain:
int backslashPos = ioc.UserName.IndexOf("\\", StringComparison.Ordinal);
if (backslashPos > 0)
{
string domain = ioc.UserName.Substring(0, backslashPos);
string user = ioc.UserName.Substring(backslashPos + 1);
wc.Credentials = new NetworkCredential(user, ioc.Password, domain);
}
else
{
wc.Credentials = new NetworkCredential(ioc.UserName, ioc.Password);
}
if (digestAuth)
{