Impersonate user


  • Hi there!

    I'm working on program from which you should be able to configure different websites on different servers. Some of these servers are in Active Directory and some are not.

    So far I have only added support to edit servers which I (my account on the computer running the program) have access to.

    How can I impersonate Active Directory/Computer users to gain access to these other IIS servers? Managed code would be preferrable.

    Thanks in advance,
    Peter Larsson!
    Tuesday, August 01, 2006 1:37 PM


All replies

  • Full working code with article:
    Windows Impersonation using C#
    Tuesday, August 01, 2006 2:20 PM
  • I wrote a full Impersonation helper class that is easy to use. You can take look at it here:

    Impersonation class, C# Source

    Wednesday, October 18, 2006 12:42 PM
  • Thanks for the reply and the class you shared, really great!

    Except that I can't get it to work :(

    When I try to impersonate a domain user i get the error code:
    There are currently no logon servers available to service the logon request.

    I've tried all Logontypes, ntml and upn type logins but with no results.

    My knowledge in networking/security is not that great, am I missing something?

    Best regards,
    Peter Larsson
    Monday, November 06, 2006 3:54 PM