Last post Apr 08, 2014 11:07 PM by chetan.sarode
Apr 06, 2014 04:22 PM|slcosta|LINK
Is it the case that the current version of ToolkitScriptManager cannot run under medium trust?
If so, is there any intention to fix this?
For days I've been trying to update my website from ASP.Net 3.5 using toolkit version 3.5.40412.2. I thought the error (System.Reflection.ReflectionTypeLoadException)
was due to some incompleteness of my updating of references. But now it's looking like the ToolkitScriptManager simply can't run under medium trust.
Apr 07, 2014 11:00 PM|Fuxiang Zhang - MSFT|LINK
Thanks for your post.
For AjaxControlToolkit in Medium Trust Hosting, it may throw a security exception.
System.Security.SecurityException was unhandled by user code
Please try to use the ToolkitScriptManager replace the ScriptManager. And find solutions from below.
the error (System.Reflection.ReflectionTypeLoadException)
As for above error message. I think we should add some configuration about AjaxControlToolkit to web.config.
Hope that helps, thanks.
Apr 08, 2014 02:49 PM|slcosta|LINK
Thanks for your reply.
I haven't encountered the security exception, just the ReflectionTypeLoadException, which happens as soon as I load
the site, since the ToolkitScriptManager is on the master page.
Note that I didn't have this problem in toolkit version 3.5.40412, but when I upgraded to the latest version, it showed up.
I have already tried most of the ideas in the threads you referenced. I have now tried the web.config change in the Codeproject link.
I also note that if I change any of my Ajax-enabled sites (with the current toolkit version) to Medium trust, they also get the
ReflectionTypeLoadException. The problematic website's production version is on GoDaddy, so I don't have a choice of trust level, which is why I run it under medium on my development machine.
Does anyone know for a fact that the ToolkitScriptManager can work under medium trust? I've been looking at various forums for days. Many people have this problem and none have solved it as far as I can tell. I'm beginning to think that it cannot be done,
at least with more recent versions.
Apr 08, 2014 10:24 PM|Fuxiang Zhang - MSFT|LINK
Thanks for your response.
Based on the discription, I think you came across the exception like below.
The type initializer for 'AjaxControlToolkit.ToolkitScriptManagerConfig' threw an exception. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
As known that Medium Trust level has no the ReflectionPermission. So we cannot use the reflection feature for some works of AjaxControlToolkit.
Thus, above exception occurs, what I suggest you can try to set the Medium Trust supports ReflectionPermission using
IPermission settings like below.
<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<IPermission class="ReflectionPermission" version="1" Flags="RestrictedMemberAccess"/>
For more information, please try to check below thread.
Apr 08, 2014 11:07 PM|chetan.sarode|LINK