Results 1 to 4 of 4

Thread: Impersonation - Is this possible?

  1. #1

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565

    Question Impersonation - Is this possible?

    I am trying to design a windows forms application (not asp.net) in C#, and need to know if the following scenario is possible :

    Once my application is running I need to be able to impersonate another user account which will have access to a network drive that the current user account does not have access to. Is it possible to impersonate the required user account and map to the drive in code, enabling the current user to view the required files?

    I need to do this so that users can only view/alter files from my application. All the files will only be accessible via a user account (which only the admin will know), thus stopping tampering with the files except via the application.

    Can anybody can tell me if this is possible, and if it is possible some example code would be much appreciated.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Impersonation - Is this possible?

    Short answer: No








    Long answer: Nooooooooooooooo
    I don't live here any more.

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Did yo search the MSDN Help . I found the example "Allows code to impersonate a different Windows user " , it could be what you're looking for .

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: Impersonation - Is this possible?

    You are doing somthing wrong if you need to impersonate someone in your application. First of all, you will need to store the identity information in your application. This is just wrong for all kinds of reasons.

    Think about creating a web service or something that controls access to the resource if it is precious enough to not let users access normally. Then, users can still access the web service directly, but they can only do what the web service normally does for your application.

    The other way, if they get access to the user name/password combo, they get to elevate their privilage and do other things that weren't intended.

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