且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WebMethod(有时)返回整个网站

更新时间:2023-10-23 12:00:40

以下是有关相同的问题可能会说明情况.基本上,它说这是不起作用的,因为处理PageMethods的处理程序正在寻找{pagename.aspx}/{methodname},并且您的url重写导致它无法识别您正在调用的是page方法.

Here's a discussion about your same issue that might shed some light on the situation. Basically, what it says is that it's not working because the handler that deals with PageMethods is looking for {pagename.aspx}/{methodname}, and your url rewriting is causing it to not recognize you are calling a page method.

该页面上的一个建议是在自动生成相同签名的调用之后,在您的javascript代码中添加以下内容:

One suggestion on that page was to add the following in your javascript code somewhere after the auto-generated call of the same signature:

PageMethods.set_path('/items.aspx');

这将使它使用实际URL而不是重写的URL来调用您的页面方法.

This will make it call your page method using the real url instead of the rewritten one.