Please help me with this? I tried to log into the .microsoftonline.com portal with the necessary credentials, but I got this error. Is my url wrong or what? Because I'm trying to personalize and give the role to the user. Thanks, and btw, I'm new here, please forgive me for how I post my problem. Please see Comment for error.
class SecurityHelpers { private SecurityHelpers() { } [DllImport("advapi32.dll", SetLastError = true)] private static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] private extern static bool CloseHandle(IntPtr handle); public static WindowsIdentity CreateIdentity( string userName, string domain, string password) { IntPtr tokenHandle = new IntPtr(0); const int LOGON32_PROVIDER_DEFAULT = 0; const int LOGON32_LOGON_NETWORK_CLEARTEXT = 3; tokenHandle = IntPtr.Zero; bool returnValue = LogonUser(userName, domain, password, LOGON32_LOGON_NETWORK_CLEARTEXT, LOGON32_PROVIDER_DEFAULT, ref tokenHandle); if (false == returnValue) { int ret = Marshal.GetLastWin32Error();
source share