HttpContext.Current 属性 ---为当前 HTTP 请求获取或设置 HttpContext 对象。

protected void Page_Load(object sender, EventArgs e)
{
    HttpContext context = HttpContext.Current;
    Response.Write("

HttpContext.Current Example:

"); // Add three custom exceptions. context.AddError(new Exception("New Exception #1")); context.AddError(new Exception("New Exception #2")); context.AddError(new Exception("New Exception #3")); // Capture all the new Exceptions in an array. Exception[] errs = context.AllErrors; foreach (Exception ex in errs) { Response.Write("

" + Server.HtmlEncode(ex.ToString()) + "

"); } // Clear the exceptions so ASP.NET won't handle them. context.ClearError(); }

 

你可能感兴趣的:(C#数据结构)