Results 1 to 10 of 10

Thread: Impersonating a user

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Impersonating a user

    I have scowered google for ages, and can't find any definitive code for this

    I suck at google mind you.

    I have a username and password.

    username: "Woof"
    password: "Growl123"
    domain: "WokasDomain"

    I need to impersonate this user when I run some code.
    Does anyone have a function for this?

    Woka

  2. #2
    Lively Member
    Join Date
    Jan 2006
    Posts
    108

    Re: Impersonating a user

    I'm really not sure this is what you are after and also its for VB5/6....but maybe you can use some of the code?

    http://www.freevbcode.com/ShowCode.asp?ID=4298
    VB.Net 2005 Express
    .Net Framework 2.0

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,817

    Re: Impersonating a user

    Quote Originally Posted by Wokawidget
    I have scowered google for ages, and can't find any definitive code for this

    I suck at google mind you.

    I have a username and password.

    username: "Woof"
    password: "Growl123"
    domain: "WokasDomain"

    I need to impersonate this user when I run some code.
    Does anyone have a function for this?

    Woka
    Hi,

    Did you do a look in the MSDN library for that.

    wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092

    Re: Impersonating a user

    What version of .NET?

    In 2.0, if it can be broken out into another exe, then the username, domain, and password are params into Process.Start().
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

  6. #6
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    Re: Impersonating a user

    Woka,

    Take a look at this msdn blog

    I'm not sure if it is completely what you need but will certainly get you started.

  7. #7

  8. #8
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    Re: Impersonating a user

    This MSDN Code code should do it. Using this code I was able to successfully impersonate a local user and open a folder that only that user has rights to.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Impersonating a user

    I found a link (with Google ) that shows how to do this with a modification to the web.config file. Would that do you any good?

  10. #10
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    Re: Impersonating a user

    I'm not sure but I think he was looking for something in winforms. That last MSDN link I posted does have the complete code in VB.NET and C# to impersonate a user including the prompts for username, password and domain. I tried it in 1.1 because that is what Woka needs and it works right as posted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width