1. 我在web.config 中的 <system.web>节点中加入
<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro"/>
</httpHandlers>2. 在namespace为 Test,类名为TestAjax的cs文件中加入 [AjaxPro.AjaxMethod]
using System;namespace Test
{
public class TestAjax
{
public TestAjax()
{

} [AjaxPro.AjaxMethod]
public string GetString()
{
return "this is a ajax method!";
} }
}3. 在 index.aspx 中的 index.aspx.cs Page_Load中加入如下代码
namespace Test
{
/// <summary>
/// index 的摘要说明。
/// </summary>
public class index : System.Web.UI.Page
{

private void Page_Load(object sender, System.EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Test.TestAjax));
} }
}4.在 index.aspx的html的中将<form id="Form1" method="post" runat="server"></from>改成如下代码
<form id="Form1" method="post" runat="server">
<script language=javascript>
window.onload = function()
{
var res = Test.TestAjax.GetString().value;
alert(res);
}
</script>
</from>本地测试可用 上传到服务器后 var res = Test.TestAjax.GetString().value;
出错提示 Test未定义