First, create a new .net4.0 Class Library project, add reference to System.Web.dll. then add a new class file to the project named say MyHttpHandler.cs:
using System;
using System.Web;
namespace Xhinker.TableTopic {
public class MyHttpHandler:System.Web.IHttpHandler {
public bool IsReusable {
get { return true; }
}
public void ProcessRequest(HttpContext context) {
context.Response.Write("good,very good,llalalala");
}
}
}
Now in your ASP.NET site project add a reference to this Class Library project. open Web.config file. Under <system.webServer> node. add
<handlers>
<add name="handlerTest" verb="*" path="myHandler.han"
type="Xhinker.TableTopic.MyHttpHandler,TBHttpHandlers"/>
</handlers>
Build the solution and it will work.
Now, why do I bother to create a new HttpHandler?
Nowadays, so many new technology spawn our mind. but truly speaking, the most basic things last longer. and I think that a raw httpHandler will be great to serve as a restful service for Javascript.
92952227-2016-41b8-8e44-1cd06d2e9e59|0|.0
ASPNET