serverhandler.cs

来自「C#开发者可使用的经典案例集,源自于ASP.NET经典范例50讲」· CS 代码 · 共 24 行

CS
24
字号
using System.Web;
using System.Collections.Specialized;

public class ServerHandler : IHttpHandler 
{
  public void ProcessRequest(HttpContext context)
  {
    HttpResponse Response = context.Response;
    Response.Write("<html><body>");
    Response.Write("<h3>Server Introduction</h3>");

    NameValueCollection coll = context.Request.ServerVariables; 
    foreach(string key in coll.AllKeys)
      Response.Write(key + "=" + coll[key] + "<br>");

    Response.Write("</body></html");
  }

  public bool IsReusable 
  {
    get { return false; }  
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?