I was getting the following error message when I was trying to access a web application using the Ajax Control Toolkit on a new server:

Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. Access is denied.

Looking deeper, I found out that the error 0x80070005 was raised.

Reading various threads and blogs, I eventually found out that the problem was caused by the fact that the site is using impersonation. Look for a line like the following one in your Web.config file:

<identity impersonate=true userName=“… password=“… />

Because the web application is running under a specific user, I had to grand Full Control to that user on the following directory:

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

I’m not sure if it is a security breach to grant Full Control to a user on that directory, but it solved my problem. Also, in the reading I did, I saw that there were other reasons for this error to occur.