I got a complicated problem with ASP.Net 4.0 Ajax....I started a website with Visual Studio 2010 on my machine,and added some update panels they used to work fine,but suddenly i got that series of errors when i run my website
Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.
Microsoft JScript runtime error: 'Sys' is undefined
The strange things is that i made a website on the same machine with VS 2010 and the update panels there work perfectly.i took its web.config to my new website and changed just the connection..and i got the same error
I tried to search for a solution but i failed to find any real solution.Can anyone help?
Here is the answer by zhughes from this thread on asp.net forum.
The Reason : the path of the javascript generated by the scriptmanager changes when the URL Routing module is used.
The Solution : Tell the routing API to not route the files with "axd" extension (the files generated by the scriptmanager)
Add this rule to the method where you register the routing rules in Global.asax
routes.Ignore("{resource}.axd/{*pathInfo}");
in addition you should have this section in web.config
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
if you using URL rewrite module, then in each rewrite rule add
<add input="{URL}" pattern="\.axd$" negate="true"/>
under conditions tag, like this:
<rule name="HomeRewrite" stopProcessing="true">
<match url="^home$"/>
<conditions>
<add input="{URL}" pattern="\.axd$" negate="true"/>
</conditions>
<action type="Rewrite" url="/home.aspx"/>
</rule>
I have found that this is a possibly a caching/compression issue and by putting in the following into Web.Config, resolves the issue.
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCaching="false" enableCompression="false" />
</scripting>
</system.web.extensions>
I was having the same problem. I installed VS 2010 SP1 and the problem went away.
I had the same problem and I solved it by run the command aspnet_regiis -i on the folder of the Framework 4.0 (on which my application ran). It was a problem on the Handler Mapping of IIS: this operation fix the problem for me.
See also this post.
Hope this could be helpful.
It may be simply missing part in your web.config like the <Handlers> of <httpHandlers>, my advice is if you have old copy of your web config try it out.
Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.
Add reference like this..
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
This is a common error that happens when you try to call framework javascript function before page have even loaded them.
So ether run your code when dom is ready (eg pageload), ether place your code after the scriptmanager tag, or check to place it after the javascript load from scriptmanager.
I had this problem and sought an answer from the almighty Google, tried various suggestions including the ones above but had no luck. Gave up and moved on to other work, came back a few days later and the problem had disappeared.
I resumed work, made some code changes and published my website and the problem reappeared. Went back to the Google and came across someone who had the problem while using the 3.5 framework. In that case s/he was able to resolve the problem by going to the 'Add/Remove Programs' control panel and selecting the repair option.
I did likewise, repairing the 'MS .NET Framework 4 Client Profile' and 'MS .NET Framework 4 Extended'. That fixed the problem for me.
Hope that solves it for someone else.
in my case, it's IISExpress, switch back to the cassini dev server fix my headache.
I had this problem as well dealing with a master page and in my case it was a "Base" meta setting that was messing me up. I do recall reading another article/blog somewhere where they mentioned an issue with ajax validation across different domains causing this type of error.
So in my case, I had a <base...> reference setting the default url for the site but my dev was obviously a different url...thus conflict and the "ASP.NET Ajax client-side framework failed to load." error.
Removed the base and voila...error gone.
HTH
Dave
If .Net Framework 4.0 client Profile is not available in your machine , so repair .net Frame work 4.0 or re install .
go to Project Property and select target framework 3.5.
In my case it was the UrlScan tool by Microsoft that was rejecting some URL's requested by Ajax. Disabling it solved the problem.
Related
I have an issue where my web api that works fine on my development machine is returning 404s for all routes when installed on the production server. The production server is running Windows 2008 (not R2) if this matters.
I've confirmed the correct framework is installed on said server (project is targeting 4.5.2)
I've tried the most suggested solution of adding:
<modules runAllManagedModulesForAllRequests="true" /> to <system.webServer>
but this does not work at all.
I also tried the other suggestion of adding the following instead of RAMMFAR:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
But this also doesn't seem to work at all.
Any ideas what the issue here might be or other things I can try?
Possibly irrelevant but perhaps related:
One odd thing I found while looking into the UrlRoutingModule is that if I open server level in IIS Manager and view modules, it is listed in there, but if I try to change the "invoke only for requests to ASP.NET applications..." checkbox I get the following error, which almost seems to suggest it's not installed properly or something? I tried a repair of the .net framework 4.5.2 on this basis but no luck with that either.
I manage a large asp.net site which has previously been converted from static html site to asp.net.
For several reasons (mainly SEO) we decided not to rename all the files to .aspx back when we originally converted the site. This was very easy to do by simply adding the buildProvider and httpHandler to the web.config.
<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
<httpHandlers>
<add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
Now I am upgrading the site to use Asp.net WebPages with Razor cshtml files. I can rename all the files if necessary, and use url rewriting to make the urls stay the same, however it would be much easier if I could just configure the web.config to tell it to parse .html files as if they were .cshtml.
I have searched around quite a bit, and could not find anything equivalent to the PageHandlerFactory for razor pages. It appears as though it is just an internal mechanism in the .net 4.0 ISAPI handler.
The site is currently running on Windows 2003 server and IIS 6. We will be upgrading to 2008/IIS 7.5 in the near future, but I'd prefer not to wait for that.
Is there any way to get the .html files to be parsed by razor as if they were .cshtml files?
Thank you to SLaks for pointing me in the right direction, but it still took a few hours of digging in the MVC source to figure out the solution.
1 - Need to put RazorBuildProvider in web.config
<buildProviders>
<add extension=".html" type="System.Web.WebPages.Razor.RazorBuildProvider"/>
</buildProviders>
And add System.Web.WebPages.Razor to assemblies if it isn't already there.
<assemblies>
[...]
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
2 - Add 2 lines in global.asax Application_Start() method
// Requires reference to System.Web.WebPages.Razor
System.Web.Razor.RazorCodeLanguage.Languages.Add(
"html", new CSharpRazorCodeLanguage());
WebPageHttpHandler.RegisterExtension("html");
Call WebPageHttpHandler.RegisterExtension.
You may also need to register a custom WebPageRazorHostFactory to tell the Razor engine what to do with the file; I'm not sure.
As this actually been resolved for use with VS2012 / .net 4.5.
As using the examples above in a C#5 project I get no luck :(
Yesterday we pushed out some changes including the addition of ASP.NET MVC 3 (routing, configuration, etc.) and our ASP.NET charting controls stopped working. In our development environment the ASP.NET chart control works as expected. However in our test and production env. we are getting errors from the DefaultControllerFactory as no path can be found for the axd url - "Pages/Secured/ChartImg.axd"
We've tried comparing any differences with the IIS configuration and web.config and made sure the system.webserver node has the correct handler as so...
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
This has not helped and we are not sure what else could be wrong. It appears to be the chart handler is not setup correctly, but we have no way of knowing why.
Any help would be greatly appreciated.
It turns out we had a compiler directive on the user control that switched the ImageStorageMode property of the charting control based on debug/release builds. This explained why it was only working on our dev environments that got a debug build and not the other environments. After discovering that we used the fix from this question ASP.NET Charting Control no longer working with .NET 4, which fixed the routing issue we had for the handler when the ImageStorageMode was set to UseHttpHandler.
I manage a large asp.net site which has previously been converted from static html site to asp.net.
For several reasons (mainly SEO) we decided not to rename all the files to .aspx back when we originally converted the site. This was very easy to do by simply adding the buildProvider and httpHandler to the web.config.
<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
<httpHandlers>
<add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
Now I am upgrading the site to use Asp.net WebPages with Razor cshtml files. I can rename all the files if necessary, and use url rewriting to make the urls stay the same, however it would be much easier if I could just configure the web.config to tell it to parse .html files as if they were .cshtml.
I have searched around quite a bit, and could not find anything equivalent to the PageHandlerFactory for razor pages. It appears as though it is just an internal mechanism in the .net 4.0 ISAPI handler.
The site is currently running on Windows 2003 server and IIS 6. We will be upgrading to 2008/IIS 7.5 in the near future, but I'd prefer not to wait for that.
Is there any way to get the .html files to be parsed by razor as if they were .cshtml files?
Thank you to SLaks for pointing me in the right direction, but it still took a few hours of digging in the MVC source to figure out the solution.
1 - Need to put RazorBuildProvider in web.config
<buildProviders>
<add extension=".html" type="System.Web.WebPages.Razor.RazorBuildProvider"/>
</buildProviders>
And add System.Web.WebPages.Razor to assemblies if it isn't already there.
<assemblies>
[...]
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
2 - Add 2 lines in global.asax Application_Start() method
// Requires reference to System.Web.WebPages.Razor
System.Web.Razor.RazorCodeLanguage.Languages.Add(
"html", new CSharpRazorCodeLanguage());
WebPageHttpHandler.RegisterExtension("html");
Call WebPageHttpHandler.RegisterExtension.
You may also need to register a custom WebPageRazorHostFactory to tell the Razor engine what to do with the file; I'm not sure.
As this actually been resolved for use with VS2012 / .net 4.5.
As using the examples above in a C#5 project I get no luck :(
I've defined a route in Application_Start, as so many tutorials have instructed
RouteTable.Routes.Add(
"Files",
new Route("Files/Art",
new FileRouteHandler()));
And created my own RouteHandler. However this doesn't seem to work at all.
When I debug the application, I can see (via a break point) that the route gets added, however when I browse to "http://localhost/MyApplication/Files/Art" I get a browser 404 (not an ASP.net 404).
When I place a break point in the Route Handler it doesn't break when I access the URL. A break point in Application_BeginRequest doesn't break either when accessing the URL.
This is a problem, but I completely understand why I get a generic 404. How would IIS know to process this URL with asp.net, after all it doesn't really exist??
What am I missing here?
Make sure that you have the UrlRoutingModule installed and configured in the web.config. Something similar to what's shown below:
<system.web>
...
<httpModules>
...
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
</system.web>
I knew it was a web server issue...
http://www.asp.net/%28S%28pdfrohu0ajmwt445fanvj2r3%29%29/learn/mvc/tutorial-08-vb.aspx
Short answer: With IIS 6 and below (5.1 in my case) a path such as "Files/Art" doesn't work. It won't be passed to ASP.net. However, a path such as "Files.svc/Art" will work.
The point is that IIS 6 and below needs a file extension to know what ISAPI plug in to use. In my case ".svc" is configured to use ASP.net.
Hope that makes sense...