asp.netasp.net-mvcwindowsdomainaccount

Run ASP.NET MVC app as a specific user


I have a an ASP.NET MVC application that will need to access file resources on another machine, so I have shared the relevant directory and given a fresh domain user access to it. My question is: How do I get my ASP.NET MVC app to take on this new user's identity? Do I have to set this up separately when debugging and when deployed?

Thanks!


Solution

  • <identity impersonate="true"
              userName="domain\user" 
              password="password" />
    

    in your web.config should work. The other option (not recommended) is running your application pool as a user with the proper credentials.