当前位置:首页 > 网络编程 > WEB编程 > ASP.net > .NET Ajax的无刷新技术实例详解

.NET Ajax的无刷新技术实例详解

点击次数:27 次 发布日期:2008-11-21 22:28:33 作者:源代码网
源代码网推荐

源代码网整理以下该开发包的新版本还没有来得及体验,估计新版本中会方便一些,可能会去掉手动的设置Global.asax的Application_Start事件中加上Ajax.Utility.HandlerPath = "ajax";以及其他麻烦的设置。

源代码网整理以下下载一个.net Ajax开发包,该开发包包括ASP2.0和目前ASP1.1版使用的Ajax,详细地址参见http://ajax.schwarz-interactive.de/,接下来,开始。

源代码网整理以下  1. 新建一个项目,在引用中添加引用Ajax.dll,Ajax.dll位于下载的压缩包里面。

源代码网整理以下  2.建立HttpHandler,在web.config里面加上:

源代码网整理以下 

源代码网整理以下<configuration>

源代码网整理以下lt;
system.web>

源代码网整理以下lt;
httpHandlers>

源代码网整理以下lt;
add verb="POST,GET"
path="ajax/*.ashx"
type="Ajax.PageHandlerFactory,
Ajax" />

源代码网整理以下lt;
/httpHandlers>

源代码网整理以下<system.web>

源代码网整理以下lt;
/configuration>
 

源代码网整理以下
  3.新建一个类DemoMethods,这个类实现获取客户端MAC地址:

源代码网整理以下
using System;

源代码网整理以下using System.Web;

源代码网整理以下namespace AjaxSample

源代码网整理以下{

源代码网整理以下/**//// <summary>

源代码网整理以下/// Summary description for Methods.

源代码网整理以下/// </summary>

源代码网整理以下ublic class DemoMethods

源代码网整理以下{

源代码网整理以下[Ajax.AjaxMethod]

源代码网整理以下ublic string GetCustomerMac(string clientIP)
//这里输入客户端IP,这个函数知识测试用,
你也可以写一个其他的简单一点的函数代替

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华