[DllImport("Advapi32.dll")]
extern static bool LogonUser(string userName, string domain, string password, int LogType, int dwLogonProvider, ref int Phandle);
int pvalue = 0;
bool b = LogonUser(UserName, Localhost, Password,2, 0, ref pvalue);
MessageBox.Show(b.ToString());