locked
User Impersonation for Windows Form Applications RRS feed

  • Question

  • We have an windows forms application that runs on Windows 7 23-bit OS. Access to the application is based on user groups. Users (i.e lgoged-in into that system/pc) belongs to one particular user groups has access to the applicaiton. This application generates log files which needs needs to be protected from the all users except admin i.e only users belongs that group are allowed to read/view the log file content but should not modify or delete log files.

    The problem here is logged-in user does not have write permission on log files for writing logs.

    I know user impersonation for this kind of problem.

    What are other solutions available for this problem?

    If I use user impersonation which location is best way to stores user credentials (user name, passwrod, etc)?

    Option 1: Hard code user credentials in the application.

    Thanks in advance

    Wednesday, August 17, 2011 2:16 PM

All replies

  • This sounds like a good candidate for a Windows service. You can have the Windows Service, which runs under localsystem, to write the log, and accept log request from other processes running in the user's context. 

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Wednesday, August 17, 2011 6:17 PM
  • Thanks for reply.

    Can I run user LOCAL SERVICE, SYSTEM SERVICE OR NETWORK SERVICE for writing data into files? If yes, how to acheive that?

    Thursday, August 18, 2011 9:47 AM
  • Depends on what do you do in the service. For example if you want networking in the service, NETWORK SERVICE would be a good candidate.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Friday, August 19, 2011 6:53 PM