using System; using System.Net; namespace AppLimit.CloudComputing.SharpBox.StorageProvider { /// /// This class contains the needed access credentials for a specific webdav /// user /// public class GenericNetworkCredentials : GenericCurrentCredentials { /// /// Useraccount of the end user with access to the WebDav share /// public string UserName { get; set; } /// /// Password of the end user with access to the WebDav share /// public string Password { get; set; } /// /// returns network credentials which are usable in a webrequest /// /// /// /// public override NetworkCredential GetCredential(Uri uri, string authType) { if (UserName.Contains("\\")) { var domain = UserName.Split('\\')[0]; var user = UserName.Split('\\')[1]; return new NetworkCredential(user, Password, domain); } return new NetworkCredential(UserName, Password); } public override string ToString() { return string.Format("{0}+{1}", UserName, Password); } } }