public static Boolean Impersonate()
{
String domain = string.Empty;
String userName = string.Empty;
String password = string.Empty;
String splitter = @"\";
String full = H3Config.GetKeyAsString("ImpersonationIdentity", "", "Argentini.Halide");
Int32 s1 = full.IndexOf(splitter);
Int32 s2 = full.IndexOf("/");
if (s1 > 0 && s2 > 0)
{
if (s2 < s1)
{
splitter = "/";
}
}
else
{
if (s2 > 0)
{
splitter = "/";
}
}
// Access the <appSettings> value
String[] userAndpassword = full.Split(';');
// Parse out the domain, username and password
domain = userAndpassword[0].Substring(0, userAndpassword[0].IndexOf(splitter));
userName = userAndpassword[0].Substring(userAndpassword[0].IndexOf(splitter) + 1);
password = userAndpassword[1];
return Impersonate(domain, userName, password);
}