Configure .net app to run as current user

Steve Last 21 Reputation points
2021-08-11T22:15:39.347+00:00

Is it possible to configure the .net app and app pool to run as the user who's currently running the app? I have looked everywhere and have seen asp.net impersonation, authentication method and nothing seem to work.

Part of the application is to read/generate files from folder that Person A have access to. If Person B doesn't have access to target folder then app will give error message. Doing impersonation with provided service account will defeat this purpose.

Internet Information Services
{count} votes

Accepted answer
  1. Bruce Zhang-MSFT 3,741 Reputation points
    2021-08-12T04:29:28.067+00:00

    Hi @Steve Last ,

    If you want to set app pool run as the user who's currently running the app, the only way is add user in windows user group. It cannot changed when application running, then user login. Even using impersonation.

    What you can configure is the user who run the application. However, you don't want to use impersonation. So there's no useful methods to change user at IIS level. You need to set it in application by writing code.

    So I recommend you to use authentication filter and authorization filter.


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Bruce Zhang

    0 comments No comments

0 additional answers

Sort by: Most helpful