Friday, December 10, 2010

ASP.NET Impersonation and "Could Not Load File or Assembly" Error

When setting up an ASP.NET site on a server if you are using impersonation on the web site, typically set via the setting, you need to ensure that the user account being impersonated has access to the server. Typically this means you need to add that user account to the Users or Administrators group on the server. 

If you do have the appropriate permissions granted to the impersonating user, you will most likely receive an error message similar to "Could not load file or assembly or one of its dependencies. Access is denied". This is because the account does not have access to write to the c:\Windows\Microsoft.Net\Framework\\Temporary ASP.NET Files" directory.

I have run into this issue numerous times and keep forgetting how to fix, so I finally decided to post it here, in hopes that I will find it the next time and hoepfully help someone else out as well.

No comments: