How to make controls from ajax control toolkit work in project upgraded from VS2008 to VS2010
I had a working project in VS2008 / .Net 3.5 using controls from the ajax control toolkit (which targets .Net 3.5).
I upgraded the project in VS2010 Beta 2. I chose to target .Net 4.0 so I could take advantage of routing for WebForms (which is working).
When a page with a ModalPopupExtender loads, however, I get errors, "Syntax error" referencing a URI like:
{localhost}/WebResource.a开发者_运维问答xd?d=-sR5kj2yKK777ENh8pDLSA2&t=633960551687981257. Then the page loads incorrectly because the necessary javascript files failed to load.I tried downloading the new control toolkit from ajax.codeplex.com and referencing the AjaxControlToolkit.dll within, clearing out temporary files for framework 2.0 & 4.0, but it made no difference.
I then read this post about further debugging the error. When I decrypted the requests to WebResource.axd, they showed paths that looked like yay:
- s|WebForms.js
- ZSystem.Web,4.0.0.0,,b03f5f7f11d50a3a|WebUIValidation.js|
So pipe delimited references to files seem to have been constructed incorrectly. It seems unlikely anyone would have any idea what to do about this, but what the heck...
add
RouteTable.Routes.Ignore( "*.js" );
to RegisterRoutes in Global.ascx.cs
You can download the source from codeplex and rebuild it for .NET 4.0 via VS 2010 but i don't think it will do much help.
If you want to use Routing which is part of .NET 3.5 (with SP1) what you have to do is to exlude *.axd handlers from being routed.
Here is a sample C# code to achieve that
RouteTable.Routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler()));
精彩评论