Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
URL重写影响ASP.NET AJAX_Asp.net_Asp.net Ajax_Url Rewriting_Ajaxcontroltoolkit - Fatal编程技术网

URL重写影响ASP.NET AJAX

URL重写影响ASP.NET AJAX,asp.net,asp.net-ajax,url-rewriting,ajaxcontroltoolkit,Asp.net,Asp.net Ajax,Url Rewriting,Ajaxcontroltoolkit,我正在我的项目中使用URLRewriting。所有功能都正常工作,但我无法使用像updatePanel等ASP.NET Ajax。问题是缺少ScriptResource.axd文件(404错误)。在使用URLRewriting之前,我使用了很多ASP.net Ajax控件,因此我无法更改整个代码 如何启用ASP.NET Ajax 有任何替代方案可以替代ASP.NET Ajax,而无需更改代码隐藏 添加明确避免阻塞或重新路由所有.axd文件的规则 例如,MVC项目有以下特定的路由例外: route

我正在我的项目中使用URLRewriting。所有功能都正常工作,但我无法使用像updatePanel等ASP.NET Ajax。问题是缺少ScriptResource.axd文件(404错误)。在使用URLRewriting之前,我使用了很多ASP.net Ajax控件,因此我无法更改整个代码

  • 如何启用ASP.NET Ajax
  • 有任何替代方案可以替代ASP.NET Ajax,而无需更改代码隐藏

  • 添加明确避免阻塞或重新路由所有.axd文件的规则

    例如,MVC项目有以下特定的路由例外:

    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    

    这可以确保Ajax(除其他外)正常工作。

    添加一条规则,明确避免阻塞或重新路由所有.axd文件

    例如,MVC项目有以下特定的路由例外:

    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    

    这确保了Ajax(除其他外)正常工作。

    您必须在web.config文件中配置URL重写模块

    否定所有.axd或.svc或任何jquery或webservice请求或任何指定文件或URL

    例如

    <rule name="Lower Case URLs" stopProcessing="true">
          <match url="[A-Z]" ignoreCase="false"/>
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="WebResource.axd" negate="true"/>
            <add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
            <add input="{URL}" pattern="CIMService.svc" negate="true"/>
          </conditions>
          <action type="Redirect" url="{ToLower:{URL}}"/>
        </rule>
        <rule name="Trailing Slash" stopProcessing="true">
          <match url="(.*[^/])$"/>
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{URL}" pattern="WebResource.axd" negate="true"/>
            <add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
            <add input="{URL}" pattern="CIMService.svc" negate="true"/>
          </conditions>
          <action type="Redirect" url="{R:1}/"/>
        </rule>
    

    您必须在web.config文件中配置URL重写模块

    否定所有.axd或.svc或任何jquery或webservice请求或任何指定文件或URL

    例如

    <rule name="Lower Case URLs" stopProcessing="true">
          <match url="[A-Z]" ignoreCase="false"/>
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="WebResource.axd" negate="true"/>
            <add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
            <add input="{URL}" pattern="CIMService.svc" negate="true"/>
          </conditions>
          <action type="Redirect" url="{ToLower:{URL}}"/>
        </rule>
        <rule name="Trailing Slash" stopProcessing="true">
          <match url="(.*[^/])$"/>
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{URL}" pattern="WebResource.axd" negate="true"/>
            <add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
            <add input="{URL}" pattern="CIMService.svc" negate="true"/>
          </conditions>
          <action type="Redirect" url="{R:1}/"/>
        </rule>