- Visual Studio 2010/Solution Explorer
- Solution.Add New Project.Visual C#.Web.ASP_NET Empty Web Application
- Project.Add New Item.Visual C#.Generic Handler
aj.ashx
<%@ WebHandler Language="C#" Class="Aj" %>
using System;
using System.IO;
using System.Web;
public class Aj : IHttpHandler {
public void ProcessRequest (HttpContext context) {
Stream stIn = context.Request.InputStream;
int nLen = (int)stIn.Length;
byte[] aIn = new byte[nLen];
stIn.Read(aIn, 0, nLen);
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string sData = enc.GetString(aIn);
string[] aData = sData.Split();
int nA = Convert.ToInt32(aData[2]);
int nB = Convert.ToInt32(aData[3]);
int nResult = nA + nB;
context.Response.CacheControl = "no-cache";
context.Response.ContentType = "application/javascript";
context.Response.Write("["+nResult.ToString()+"]");
}
public bool IsReusable {get {return false;}}
}
No comments:
Post a Comment