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!

有帮助吗?

解决方案

<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.

其他提示

MVC Still uses ASP.NET authentication so you should just need to use:

<identity impersonate="true"/>

In the web.config.

Are you running your MVC application within IIS? If so, set this user as the application pool identity. If not, you can use impersonation from within the web.config

http://msdn.microsoft.com/en-us/library/xh507fc5(v=vs.100).aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top