|
<div id="cnblogs_post_body">axd文档与ashx文档有相似的功能。此博文中,Insus.NET演示如何在Javascript呼叫到axd文档。能呼叫到axd文档,当然也可以呼叫到ashx的,不过此次axd是主角。
在你的专案的App_Code中,创建一个类别,记得要实作IHttpHandler接口。
<div class="cnblogs_code" > View Code <div class="cnblogs_code_hide" id="cnblogs_code_open_3cf3ab67-4543-4cbd-8bdb-2d2cceda9e21">using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for InsusClass
/// </summary>
namespace Insus.NET
{
public class InsusClass : IHttpHandler
{
public InsusClass()
{
//
// TODO: Add constructor logic here
//
}
public bool IsReusable
{
get { throw new NotImplementedException(); }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/Plain";
string parm = context.Request.Params["v"];
context.Response.Write("Hello, " + parm);
}
}
} |
|