ASP.Net Impersonation and Could not load file or assembly error.

In my recent ASP.NET project we used ASP.NET Impersonation to gain access to file server which is physically separated from ASP.NET web server (WINDOWS 2003 Server).We defined impersonation in the web.config file as

<identity impersonate=”true” username=”TestUser” password=”P@ssw0rd” />

We faced with following error while accessing our application for the first time after deployment.
impersonation&couldnotload
It is a permission related issue for the Temporary ASP.NET Files. The solution to the above problem is
giving read/write” access permission for “Everyone” user on 

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

The MSDN Says [ASP.NET Impersonation]:

The application identity that is being impersonated needs to have read/write access to this directory. The impersonated application identity also requires at least read access to the files in application directory and subdirectories.

Note: Actually we tried giving read/write access to the application identity that is being
impersonated but it didn’t work then we
gave read/write permission to “Everyone” user and it worked.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s