LogonUser() failed with error code 1326

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarkBrend
    New Member
    • Feb 2010
    • 1

    LogonUser() failed with error code 1326

    Hi,

    i am trying to connect to a non domain server that has a folder shared.
    i am getting
    I know the user and password are correct

    Any ideas?

    Code:
                    IntPtr token;
                    WindowsIdentity wi;
    
                    //if (LogonUser ("<user name with network share access>", "<domain name>", "<user password>", 8, // LOGON32_LOGON_NETWORK_CLEARTEXT 0, // LOGON32_PROVIDER_DEFAULT    out token))
                    if (LogonUser(@"fluency", @"\\flcy_fluency", "password", 8, 0, out token))
                    {   
                        wi = new WindowsIdentity (token);    
                        WindowsImpersonationContext wic = wi.Impersonate ();
                        
                        StreamWriter sw = File.AppendText(@"\\flcy_fluency\DNC_Lists\TenantDNC.txt");
                        sw.WriteLine(tbTel1.Text);
                        sw.Close();
    
                        wic.Undo ();
                        CloseHandle (token);
    
                    }
    Last edited by tlhintoq; Feb 23 '10, 03:40 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    Working...