For asp.net to run in a user context you need to add
<identity impersonate="true" userName="UserX" password="Password123"/>
in the web.config to impersonate
Let us say that we have a Web server A and Fileserver B .We have mapped a virtual directory RemoteSharedFolder using IIS and pointing to share as
\ \FileServerB\SharedFolder (no spaces)
We know for a fact that we need to impersonate because the aspnet_wp account would not have access to the folder and if we do not have a network user to access the resource follow the simple steps below:
- Create a local user account in webserver say UserX with password Password123
- Create a local user account in File server with same name as above and same password UserX and Password123
- If you are using windows xp or windows .net server 2003 you don’t need do anything
- If you have Windows 2000 go to local security setting and browse to “User Rights assignment” and locate “Act as part of Operating System” policy. Double click and add “aspnet_wp” account
- Restart IIS service
You need to set permission for impersonated user for full control on C:\winnt\Microsoft.NET\Framework\v1.0.3705\Temporary ASP.NET Files so that the stream read from client as temporary stored in this folder till it is transferred to the Virtual Folder