Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied. RRS feed

  • Question

  • User1245683883 posted

    I just installed AJAX Beta 2 and the updated AjaxControlToolkit. I'm getting this error when I try to access the site. Any Ideas?


    Stack Trace:

    [FileLoadException: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.]
    System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
    System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
    System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
    System.Reflection.Assembly.Load(String assemblyString) +25
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32

    [ConfigurationErrorsException: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.]
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596
    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +3487305
    System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46
    System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177
    System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +267
    System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +36
    System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +429
    System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +73
    System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +580
    System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +93
    System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +111
    System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +54
    System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
    System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
    System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +139
    System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
    Wednesday, November 8, 2006 5:18 PM

All replies

  • User-1256429567 posted

    You probably need to do one of the following:

    1. Make the assembly copy local.

    2. Put the assembly in the GAC.

    Thursday, November 9, 2006 8:49 AM
  • User1245683883 posted


    The solution that worked for me was I had to change my permissions on the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder. That corrected the issue!

    Thursday, November 9, 2006 10:41 AM
  • User-1256429567 posted
    That would work too. I just prefer to not do that. I would rather either have it in the GAC or have it copy local.
    Thursday, November 9, 2006 11:11 AM
  • User-1429816726 posted
    I'd guess your ASP.NET AJAX install wasn't successful, but it's hard to tell without more information. For what it's worth, the AjaxControlToolkit DLL does NOT need to be in the GAC.
    Tuesday, November 14, 2006 5:59 PM
  • User1458092160 posted
    Well, I'm getting the same error, and so far none of the suggestions have worked.  I have a rather large web app that worked fine this morning, but then I upgraded to ASP.NET AJAX 1.0 and now this app gives me this same error.  There is only one mention of AjaxControlToolkit in the entire application, on a page in a subdirectory off the main site, but I'm getting this error when I try to go to ANY page on the site.  The reference is this:  
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

    I've got the AjaxControlToolkit.dll file in my Bin folder, and I've re-added it a couple times, and then updated the reference, but no joy.  I'm not sure what else to do.

    One interesting thing that's happening is, I've deployed this app to our development server and it runs fine - no errors, even on the page that references the assembly.  However, the development server has NOT yet been upgraded to ASP.NET AJAX 1.0.  This error only happens on my local instance...  So it appears to be related to the new AJAX release, not the AjaxControlToolkit assembly (I do have the most recent release of the ACT on the dev server in my Bin directory)...

    If anyone has any other ideas for how I might get this working, please reply!



    Tuesday, January 23, 2007 5:45 PM
  • User-864406144 posted
    Try restarting IIS and completely closing/reopening your webbrowser.  I had the same error and restarting IIS corrected it.
    Tuesday, January 23, 2007 6:52 PM
  • User1458092160 posted

    I tried what you suggested, but I still get the same error.  I did try installing it to the GAC, but I get an Access denied error there as well:

    "Failure adding assembly to the cache: Access denied."

    This is an app that I am constantly updating and re-publishing to the site, so it's got me very concerned since I have to launch a new version of it next week...  PLEASE, if anyone can tell me how to resolve this, let me know - I am DESPERATE.



    Wednesday, January 24, 2007 12:12 PM
  • User1458092160 posted

    One more thing...  If I open up the Sample website from the AjaxControlToolkit and try to compile I get the same error:

    Error 1 Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.  

    So this seems to be a system-wide error.  I re-ran the installation of the 1.0 extensions (repair) and the CTP, but no luck...

    Wednesday, January 24, 2007 12:33 PM
  • User1521926456 posted
    Could you try installing the RTW version of ASP.Net AJAX and the new toolkit which released yesterday? I think this may be because your installation may not have been successful.
    Wednesday, January 24, 2007 2:10 PM
  • User1458092160 posted

    Wel, I didn't really change anything, but when I came back from lunch everything seems to be working fine now.  I'm really stumped as to what may have caused this, or what may have fixed it, but I'm glad it's working.  Now I've got to install asp.net ajax 1.0 on my server and hope the same thing doesn't happen there...

    BTW, I did have the release of asp.net ajax installed - in fact I uninstalled it a couple times and reinstalled it, so I'm pretty sure the installation was successful.  Also, I am using the most recent version of AjaxControlToolkit.dll which came out yesterday...

    Thanks for all your help, this one, I'm afraid, is a mystery...


    Wednesday, January 24, 2007 9:37 PM
  • User1365402919 posted

    hey rb_jlm,

    How is it that you make the AjaxControlToolKit copy local?

    Friday, March 16, 2007 3:40 PM
  • User1458092160 posted

    I just added a reference to my project, pointed it to the dll and it added it to my bin folder.  I don't have it installed in the GAC...


    Monday, March 19, 2007 10:46 AM
  • User1312295453 posted
    The best solution I've found is to delete the TEMPORARY project from the directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.  This works a treat, and whenever I crash (which is when I get this error), I can rebuild in minutes - in fact, it works for any reference, not just the AJAX control toolkit.  Hope this helps someone else and saves them from pulling their hair out!
    Friday, July 13, 2007 1:59 PM
  • User460342110 posted

    Only grant read and execution permissions to the bin/AjaxControlToolkit.dll file for everyone

    Wednesday, September 5, 2007 4:20 PM
  • User882240555 posted

    copy to bin folder will do. Check http://dotnetfish.blogspot.com/2007/10/could-not-load-file-or-assembly.html 

    Monday, October 15, 2007 3:46 AM
  • User1657428098 posted

    I have almost the same problem, i have VS2005 installed on 3 computers in the office, and 4 days ago one of them stop work with ajax, i tried to remove the folder into Visual Studio 8 that i named AjaxToolkit and again unzipping the AjaxControlToolkit.zip  with the same name, but now i have a builds errors like this:

     Warning 9 Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'C:\Archivos de programa\Microsoft Visual Studio 8\AjaxToolkit\SampleWebSite\Bin\AjaxControlToolkit.dll' or one of its dependencies. The module was expected to contain an assembly manifest. PayUp.Web

    When i trid to add the reference in my web project a warning icon shows in the reference Ajaxcontroltoolkit reference, and the propierties  dont fill the culture, description, version, etc, and in the others computers the reference ajaxcontroltoolkit's propierties fill all the fields correctly.

     I tried to remove the temporaly files in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 but the error still there and i have tried to unistall the VS05 and the error still there.

     I dont know how to do!!

    Wednesday, May 21, 2008 7:44 AM
  • User1638985495 posted

    Here's what I did to resolve this under VS2008 (its probably very similar under VS2005):

    First, on any project where I'm using dlls, I always create a dll folder to hold them.  I NEVER rely on the bin folder for references (since that would be cleared out when running a clean operation and most source control programs do not include the bin file when checking in/out) or on local copies of the dll (c:\ajax\2.0\bin\ajaxcontroltoolkit.dll).  Sure, the build operation puts a copy there but thats its job--leave the bin file to the build script.  If you ever work on your code somewhere else, publish it to another machine, or hand it off to someone else; you don't have to worry about whether the new machine has its ajaxcontroltoolkit.dll installed in the same location on its hard drive as yours.  As a side note, under the properties -> advanced for the dll, I have a build action set to content and a copy to output directory set to do not copy

    Second, I go into the references, remove any current ajaxcontroltoolkit references (or any other special dlls that I was using and am moving to the dll folder),  and add the dll references back in pointing to the copies in my dll folder.

    Thirdly, if I'm going to be using something like the ajaxcontroltoolkit on most of my pages, I go ahead and throw the following into the web.config file so I dont have register statements on every page:

            <add tagPrefix="cc1" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
            <add assembly="AjaxControlToolkit"/>

    Hope this helps, it took me a while to get it right

    If this is an intermittent problem for you (ie, it works for a bit after a build and then you get a parser error), try stopping and starting IIS. In my case, the ajaxcontroltoolkit that the build script had placed in the bin folder was being replaced with an earlier verison of the toolkit. Restarting IIS seems to have fixed this. Since doing this, my version in the bin folder has not reverted to 1.16xxx, it stays a 1.19xxx and I don't have any more frustrating errors.

    Monday, June 9, 2008 12:46 PM
  • User-680634220 posted

    I too have a website, which emits these errors at random. ASP.NET is a great idea and has worked well for me many years.

    It appears, however, that Microsoft is now losing grips of its product, as to which the sporadic nature of this issue can only attest.

    It seems that an overall goal of Microsoft is to weave their users/developers into a net, from which it is diffult to migrate.

    Now that javascript libraries such as jquery has reached maturity it would seem a good occasion to look for alternatives to the ASP.NET heavyweighter and adopt for more to-the-point methods such as jquery + web services.

    Best regards

    Wednesday, September 3, 2008 2:18 PM
  • User956500997 posted
    You may receive this error if you are running your site with impersonation.  Check your web.config impersonation tag and/or the security context that the particular user is running under:
    <br /><br />

    <identity impersonate="true" userName="UserName" password="Password" />

     <br /><br />

    In my case, the fix was changing the user that was being impersonated on my local machine.  I was able to pinpoint it to this issue because the site was working on my local machine with my development web.config, but not with my live web.config, and this was one of the main differences.  I didn't make it as far as determining what specific security access was different between the two users.  I tried granting my live web.config impersontated user full access to the bin folder on my local machine to no avail.

    Tuesday, September 9, 2008 10:57 AM
  • User1619792777 posted


    Thank you .. I followed your advice and got my issue fixed.. Thanks a lot chris poter
    If any one getting this Error Message .. Please get into control panel-->Administrator Tools-->Internet Information Service-->Now Right Click on Local Computer and then select--> All Tasks---> Restart IIS
    This will fix your issue..
    Thursday, September 18, 2008 8:23 AM
  • User1944080475 posted

    I was not able to solve this problem until I finally granted access to "Everyone" on the .../Temporary ASP.NET Files folder.  However, when I looked into this, I found this worked because my application was impersonating a specific service account.  I would encourage everyone to clearly identify the user that the process is running as!  Does your web app impersonate the current user?  If so, it would likely work on your development machine, where you are an admin, but you would see this error on a server where you didn't have privileges to the temporary asp.net folder.  Also consider what identity your app pool is running under.

    Monday, September 22, 2008 12:43 PM
  • User1944080475 posted

    sorry, accidental double-post

    Monday, September 22, 2008 12:46 PM
  • User638938195 posted



     You are right...It worked for me also. Thanks man..!

    Wednesday, September 23, 2009 7:08 AM
  • User638938195 posted


       It worked for me. Thanks alot.....



    Wednesday, September 23, 2009 7:12 AM
  • User248427537 posted

    The given solution on the following site solve this problem.


    Life in the UK Test

    Monday, December 14, 2009 11:38 AM
  • User428988642 posted

    Thanks john. 

    Tuesday, June 29, 2010 7:57 AM
  • User1917459515 posted

    This also worked for me... Thanks!

    Thursday, February 17, 2011 2:05 PM
  • User-1991014421 posted

    This Issue got resolved for me when I gave permission to my Id under IISUSER and USERS group in comp management.

    Tuesday, November 8, 2011 10:32 AM
  • User1589210675 posted

    You may receive this error if you are running your site with impersonation.  Check your web.config impersonation tag and/or the security context that the particular user is running under:
    <br /><br />

    <identity impersonate="true" userName="UserName" password="Password" />

     <br /><br />

    That solved my problem

     Thanks for the answer.

    Thursday, November 10, 2011 9:18 AM
  • User-2098663303 posted

    I got this error with no reason and I came across this post. None of reply helped me but I looked at my error message and went to C:\Users\"loginUserID"\AppData\Local\Temp\Temporary ASP.NET Files

    added my creditial to folder Temporary ASP.NET Files, solved my problem.

    I thought this may help somebody.

    Thursday, January 30, 2014 10:36 AM