Hello,
I get this lovely error whenever I attempt to load an AJAXToolKit ScriptManager. It is the only one I have on the page. If I use the regulare script manager, my extenders don't detect it. I'm placing the ScriptManager just after the <Form> tag.
The frustrating part is that it works when I preview it in the browser from my development machine it works, but once I place it the live server, it crashes on me
.
I've installed all of the .dlls in the proper places.
Also, I'm trying to attempt to do this when creating a new site with the AJAX ToolKit enabled template, still to no avail.
AntLaC, WebApp Developer
![]() |
0 |
![]() |
Hi Antlac,
Your problem seems that it is mainly caused by the System Enviroments. Ajax-enabled program runs depend on .Net Framework2.0 or above.(If your application developed based on .NET Framework 3.5, please make sure it should be runs on .Net Framework 3.5) Sometimes , the newly created ajax application runs on .Net Framework 1.1(IIS). So please check it first. Second, you should check whether Asp.Net 2.0 Ajax Extensions V1.0 has been installed or not.
Best regards,
Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]() |
0 |
![]() |
Instead of starting another thread...I have the exact same error
There is no source involved.
Create a ASP.Net (3.5) page in VS08beta,
place a ToolScriptManager on the form with a TetBox and a CalendarExtendar targeting the TextBox and the 'View in Browser' and it will give you
Thoughts?
Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.] System.Web.Configuration.ApplicationSettings.EnsureSectionLoaded() +70 System.Web.Handlers.ScriptResourceHandler.IsCompressionEnabled(HttpContext context) +7 System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +30 System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +293 System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +237 System.Web.UI.ScriptManager.RegisterScripts() +507 System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +111 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2052172 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247
![]() |
0 |
![]() |
Hi MasterControlProgram,
Please change the web.config settings, I suspect your web.config is based on the .NET Framework 2.0. Here is the sample.
<!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <appSettings/> <connectionStrings/> <system.web> <!-- Commented out to avoid "The current trust level does not allow use of the 'compilerOptions' attribute" <trust level="Medium"/> --> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <!--<add assembly="System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>--> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/> </controls> </pages> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/warnaserror-" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> </compiler> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/optioninfer+" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> </compiler> </compilers> </system.codedom> <system.web.extensions> <scripting> <webServices> <!-- Uncomment this section to enable the authentication service. Include requireSSL="true" if appropriate. <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service, and to choose the profile properties that can be retrieved and modified in ASP.NET AJAX applications. <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --> <!-- Uncomment this section to enable the role service. <roleService enabled="true"/> --> </webServices> <!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --> </scripting> </system.web.extensions> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <directoryBrowse enabled="true"/> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </handlers> </system.webServer> </configuration>I hope this help.
Best regards,
Jonathan
Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]() |
0 |
![]() |
Thanks Jonathan - Made the changes you suggested, actually I just copied and pasted yours. Results below
Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.] System.Web.Configuration.ApplicationSettings.EnsureSectionLoaded() +70 System.Web.Handlers.ScriptResourceHandler.IsCompressionEnabled(HttpContext context) +7 System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +30 System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +293 System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +237 System.Web.UI.ScriptManager.RegisterScripts() +507 System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +111 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2052172 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247
![]() |
0 |
![]() |
Hi MasterControlProgram,
Please make sure that your application runs on .NET Framework 3.5 and your Ajax Control Toolkit's version is compatible with the Framework. The web.config file that I posted is based on Ajax Control Toolkit V10920. Also, you should pay attention to the settings that you added to the web.config for your needs.
Best regards,
Jonathan
Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]() |
0 |
![]() |
Jonathan - followed link, grabbed the suggested files, installed and created new tab with the 10109 version of the AJAX components.
Maybe we should start from the top.
From what I've seen in the MS training videos online (for example) the AJAX calander control is dragged onto the screen, targeted to a text box and "View in browser" ... done, works. So I tried same by following along
Here're the exact step I've taken
Open VS2008beta
Select .Net framework 3.5 from the dropdown
create new website
open the aspx page
drag a ToolkitScriptManager (v. 1010920) onto the page
drag a textbox onto the page
drag an a calender control (v. 1010920) onto the page and set its Target to TextBox1
do nothing else, build the page, then view in browser....error (above)
I am very new to AJAX in ASP.Net (coming from .Net 1.1) so maybe there are some other things (configuration? installations?) I am not aware of. Any hints or shoves in the right direction are appreciated.
Thanks!
MCP
![]() |
0 |
![]() |
Hi MCP,
It is such a weird issue. I have tested on my local machine with VS2008 + Ajax Control Toolkit V10920 and it works pretty fine. Here is the sample.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1">
</ajaxToolkit:CalendarExtender>
</form>
</body>
</html>Please recompile the Ajax Control Toolkit source code and run its CalendarExtender Sample to see whether it works properly or not. If it works, we can come to a conclusion that your enviroments are ok. So we can copy the sample website's web.config to your newly created website and refrence the AjaxControlToolkit V10920. AjaxControlToolkit V10920 has two versions. One is for .Net Framework2.0 and another is for .NET Framework3.5. So please make sure you are using the right version which should work on .NET Framework3.5.
Here is another useful hint.
I hope this help.
Best regards,
Jonathan
Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]() |
0 |
![]() |
"Please recompile the Ajax Control Toolkit source code and run its CalendarExtender Sample to see whether it works properly or not. " - Did, and does when I run the sample site, all works
"If it works, we can come to a conclusion that your enviroments are ok." - Agree
"So we can copy the sample website's web.config to your newly created website... " - Did, same results below as above...
"...and refrence the AjaxControlToolkit V10920. AjaxControlToolkit V10920 has two versions. One is for .Net Framework2.0 and another is for .NET Framework3.5. So please make sure you are using the right version which should work on .NET Framework3.5." - And now you've lost me...how can I tell the diff? If I download the 'AjaxControlToolkit-Framework3.5' do I need to repoint or create a new AJAX toolbar in my dev env? Do I need an AjaxTollbar2.0 and a AjaxToolBar3.5?
Results...
Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
![]() |
0 |
![]() |
mastercontrolprogram:
"Please recompile the Ajax Control Toolkit source code and run its CalendarExtender Sample to see whether it works properly or not. " - Did, and does when I run the sample site, all works
"If it works, we can come to a conclusion that your enviroments are ok." - Agree
"So we can copy the sample website's web.config to your newly created website... " - Did, same results below as above...
"...and refrence the AjaxControlToolkit V10920. AjaxControlToolkit V10920 has two versions. One is for .Net Framework2.0 and another is for .NET Framework3.5. So please make sure you are using the right version which should work on .NET Framework3.5." - And now you've lost me...how can I tell the diff? If I download the 'AjaxControlToolkit-Framework3.5' do I need to repoint or create a new AJAX toolbar in my dev env? Do I need an AjaxTollbar2.0 and a AjaxToolBar3.5?
Results...
Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
Hey MCP,
I had to add an assembly binding redirect. I added it just before the closing configuration element.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="3.5.0.0" newVersion="1.0.61025.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>Now though, it doesn't work in VS2008, but it does in the live server. So, I have 2 versions of the web.config.
Hopefully this will work for you.
Please mark this as answer if it worked.
AntLaC, WebApp Developer
![]() |
0 |
![]() |
Hi MCP,
mastercontrolprogram:
If I download the 'AjaxControlToolkit-Framework3.5' do I need to repoint or create a new AJAX toolbar in my dev env? Do I need an AjaxTollbar2.0 and a AjaxToolBar3.5?Actually, it is based on the .NET Framework version that you use on your project. When use different AjaxControlToolkit, please recreate the Toolbox. Hope this help.
Best regards,
Jonathan
Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]() |
0 |
![]() |
Looks like grabbing the 10920 version did the trick. I won't tell you whatelse I did that may or may not have helped (uninstall, reload) but appears to be behaving as described by M$.
Thanks!
![]() |
0 |
![]() |
I also had this error when deploying to a web server, although it worked fine when debugged from within VS 2008. In the end I found that I had duplicate dependentAssembly tags in the web.config:
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>Removing one of them fixed the error.
![]() |
0 |
![]() |
I actually have the same problem and I know I already have System Web Extensions 1.0.61025 already installed in the SP instance and working with other web parts targeting ASP.Net 2.0. This new web part project is targeting ASP .Net 3.5 and is attempting to use System.Web.Extensions 3.5. So the question is can they work together? Does the previious posts dependentAssembly mean that I can with this entry? If so where does it go?
![]() |
0 |
![]() |
Sorry Thanks my guess was the solution - just don't try putting web parts created using the ASP.Net 2.0 Extensions on the same page with ASP .Net 3.5 Ajax Extensions.... Strange things happen if you do
![]() |
0 |
![]() |