AJAX与URL重写404错误解决方法

AJAX+URL重写如何出现:

错误提示: 'Sys.WebForms.PageRequestManagerServerErrorException: An uknown error occurred while processing the request on the server. The status code returned from the server was: 404.

页面中加入以下脚本就解决了

<script   language="javascript"   type="text/javascript">  
          Sys.Application.add_load(function()  
          {  
                  var   form   =   Sys.WebForms.PageRequestManager.getInstance()._form;  
                  form._initialAction   =   form.action   =   window.location.href;  
          });  
</script>  

注意位置

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<script language="Javascript" type="text/javascript">
Sys.Application.add_load(function(){var form=Sys.WebForms.PageRequestManager.getInstance()._form;form._initialAction=form.action=window.location.href;});
</script>

你可能感兴趣的:(url重写)