日期:2014-05-17 浏览次数:20524 次
using System; using System.Collections.Generic; using System.Web; using System.Text; using System.Data; using System.Data.SqlClient; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Text.RegularExpressions; namespace idCheck.net.genealogy { /// <summary> /// getMessages 的摘要说明 /// </summary> public class getMessages : IHttpHandler { personMessage pm = new personMessage(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string requestHeader = // 这里该如何写???用于获取原始的不是解析后的请求头字符串信息!!! } public bool IsReusable { get { return false; } } } }
var sb = new StringBuilder("<head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>举例</title></head><html>"); sb.Append(Program.httpServer.Info); if (context.Request.Headers.Count > 0) { sb.Append("<hr />你的浏览器信息:<br />"); for (var i = 0; i < context.Request.Headers.Count; i++) { var k = context.Request.Headers.GetKey(i); var x = context.Request.Headers.GetValues(i); sb.Append(HttpUtility.HtmlEncode(string.Format("{0}={1}", k, string.Join(",", x))) + "<br />"); } } sb.Append("</html>");