I ran into this issue yesterday while trying to load a new Asp.Net project into my environment. The project is a asp.net web application running on Net Framework 4 running for the first time in my computer. So after getting all the files from the TFS server I ran into this error message:
Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. Access is denied.
Exception Details: System.IO.FileLoadException: Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. Access is denied.
There seemed to be lots of solutions for this issue but at best the solutions will work some of the time, so it is difficult to pick which one is the correct one. Most of the time this happens because the cause can be different things and not just one.
The solution, at least in my case, was the information below the error message and it reads something like this:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/b9f2fe4d/87AA316a/AjaxControlToolkit.DLL.
Looks to me like the web application is trying to download the file and not being able to do so. Definitely a rights issue. My solution was to give the web application user and\or impersonator account WRITE access to the Temporary Folders under Framework\v4.0.30319. Once I did that, the web application was able to save to the temporary files and the application able to run.