Ajax client-side framework failed to load Asp.Net 4.0

后端 未结 13 1506
轮回少年
轮回少年 2020-12-08 07:56

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 sudden

相关标签:
13条回答
  • 2020-12-08 08:10

    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>
    
    0 讨论(0)
  • 2020-12-08 08:12

    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.

    0 讨论(0)
  • 2020-12-08 08:13

    in my case, it's IISExpress, switch back to the cassini dev server fix my headache.

    0 讨论(0)
  • 2020-12-08 08:14

    In my case it was the UrlScan tool by Microsoft that was rejecting some URL's requested by Ajax. Disabling it solved the problem.

    0 讨论(0)
  • 2020-12-08 08:15

    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>
    
    0 讨论(0)
  • 2020-12-08 08:16

    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.

    0 讨论(0)
提交回复
热议问题