using System;
using System.Web;
namespace MyLib {
public class SimpleHandler : IHttpHandler {
public bool IsReusable {
get {
return true;
}
}
public void ProcessRequest(HttpContext context) {
context.Response.Write("<html><head><title>SimpleHandler</title></head><body>");
context.Response.Write("<h2>The time is ");
context.Response.Write(DateTime.Now.ToString());
context.Response.Write(".</h2></body></html>");
}
}
}
BuildSimpleHandler.bat
csc /target:library /reference:System.Web.dll
/out:MyLib.dll SimpleHandler.cs
HandlerWeb.config
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="time.xxd"
type="MyLib.SimpleHandler" />
</httpHandlers>
</system.web>
</configuration>
|