惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
H
Help Net Security
The Cloudflare Blog
Y
Y Combinator Blog
A
Arctic Wolf
Cyberwarzone
Cyberwarzone
G
Google Developers Blog
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - Franky
罗磊的独立博客
Martin Fowler
Martin Fowler
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 三生石上(FineUI控件)
N
News and Events Feed by Topic
F
Fortinet All Blogs
N
News | PayPal Newsroom
J
Java Code Geeks
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
博客园 - 聂微东
S
Securelist
C
CERT Recently Published Vulnerability Notes
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
S
Security Affairs
NISL@THU
NISL@THU
A
About on SuperTechFans
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
AWS News Blog
AWS News Blog
GbyAI
GbyAI
C
Cyber Attacks, Cyber Crime and Cyber Security
V
Vulnerabilities – Threatpost
D
Docker
P
Proofpoint News Feed
W
WeLiveSecurity
Help Net Security
Help Net Security
The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
博客园 - 叶小钗

博客园 - KevinWang

Server.HtmlEncode vs HttpUtility.HtmlEncode 在FireFox IE 下Response 中文文件名乱码问题 序列化,反序列化时低序位非打印 ASCII 字符的问题 - KevinWang 月薪上万的人都懂得这些道理 c# .ToString()格式化 利用ListView和DataPager控件来对数据分页 (转) asp.net中使用ajax中的三种方式 Asp.Net2.0技巧 - KevinWang - 博客园 虚方法(virtual)和抽象方法(abstract)的区别 数据库设计经验之谈(转载) 网站令浏览器崩溃的原因 各种流行的编程风格 2009年海外Web设计风潮 常用js框架,js库 硬盘RAID是什么意思?有什么用? T-SQL和PL/SQL 区别 What is PL/SQL?(PL/SQL是什么,与T-SQL对比) 数据库和数据仓库的区别 ASP.NET MVC 资料
PageMethods Not Found (or Defined)?
KevinWang · 2010-04-23 · via 博客园 - KevinWang

If you are seeing this javascript error (or similar) while trying to use Page Methods with ASP.NET AJAX, here is a checklist that should save you some time.

  1. The page method must have the System.Web.Services.WebMethod attribute.
    [WebMethod]
    ...
  2. The page method must be public.
    [WebMethod]
    public ...
  3. The page method must be static.
    [WebMethod]
    public static ...
  4. The page method must be defined on the page (either inline or in the code-behind).  It cannot be defined in a control, master page, or base page.
    <%@ Page Language="C#" %>
    <script runat="server">
    [WebMethod]
    public static ...
  5. The ASP.NET AJAX Script Manager must have EnablePageMethods set to true.
    <asp:ScriptManager EnablePageMethods="true" For an example with full source see Calling static methods in an ASP.NET Web Page.
  6. [Reader Tip] If all else fails, be sure you are seeing the correct error.  A reader kindly reported that although they saw the "PageMethods not defined" error, the server-side code was still executing correctly.  After switching to FireFox, they discovered the real error.  Perhaps Firebug would also be quite useful while tracking down such scandalous errors. [Thank JohnL for the tip] 
    Note that you can use complex return types and parameters with page methods the same as with calling web services with ASP.NET AJAX.

posted @ 2010-04-23 11:02  KevinWang  阅读(396)  评论()    收藏  举报