JsonHandler.cs 444 B

1234567891011121314151617
  1. using System.Web;
  2. using System.Web.Script.Serialization;
  3. public class JsonHandler : IHttpHandler
  4. {
  5. bool IHttpHandler.IsReusable
  6. {
  7. get { return true; }
  8. }
  9. void IHttpHandler.ProcessRequest(HttpContext context)
  10. {
  11. HttpResponse response = context.Response;
  12. response.ContentType = "application/json";
  13. response.Write(new JavaScriptSerializer().Serialize(new { message = "Hello, World!" }));
  14. }
  15. }