HttpRuntime应用程序的运行时
System.Web.HttpRuntime类是整个Asp.net服务器处理的入口。
这个类提供了一系列的静态属性,反映web应用程序域的设置信息,而且每个web应用程序域中存在一个System.Web.Runtime类。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace HttpRuntimeDemo { public partial class _default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); //应用程序域id sb.AppendFormat("AppDomainAppId:{0}<br/>", HttpRuntime.AppDomainAppId); //web应用程序所在文件目录 sb.AppendFormat("AppDomainAppPath:{0}<br/>", HttpRuntime.AppDomainAppPath); //web应用程序的虚拟目录 sb.AppendFormat("AppDomainAppVirtualPath:{0}<br/>", HttpRuntime.AppDomainAppVirtualPath); //客户端脚本在服务器上的文件目录 sb.AppendFormat("AspClientScriptPhysicalPath:{0}<br/>", HttpRuntime.AspClientScriptPhysicalPath); //客户端脚本在服务器上的虚拟目录 sb.AppendFormat("AspClientScriptPhysicalPath:{0}<br/>", HttpRuntime.AspClientScriptVirtualPath); //asp.net安装目录 sb.AppendFormat("AspInstallDirectory:{0}<br/>", HttpRuntime.AspInstallDirectory); //bin目录 sb.AppendFormat("BinDirectory:{0}<br/>", HttpRuntime.BinDirectory); //clr安装目录 sb.AppendFormat("ClrInstallDirectory:{0}<br/>", HttpRuntime.ClrInstallDirectory); //生成代码的目录 sb.AppendFormat("CodegenDir:{0}<br/>", HttpRuntime.CodegenDir); //iss版本 sb.AppendFormat("IISVersion:{0}<br/>", HttpRuntime.IISVersion.MajorRevision.ToString()); //本机配置文件所在的目录 sb.AppendFormat("MachineConfigurationDirectory:{0}<br/>", HttpRuntime.MachineConfigurationDirectory); //是否使用iis7集成模式 sb.AppendFormat("UsingIntegratedPipeline:{0}<br/>", HttpRuntime.UsingIntegratedPipeline.ToString()); // Summary: // Gets a value that indicates whether the application is mapped to a universal // naming convention (UNC) share. sb.AppendFormat("IsOnUNCShare:{0}<br/>", HttpRuntime.IsOnUNCShare.ToString()); Response.Write(sb.ToString()); } } }
上面列出了HttpRuntime主要的几个静态属性,输出结果为
而HttpRuntime的静态方法ProcessRequest将帮助我们处理Http请求。
// // Summary: // Drives all ASP.NET Web processing execution. // // Parameters: // wr: // An System.Web.HttpWorkerRequest for the current application. // // Exceptions: // System.ArgumentNullException: // The wr parameter is null. // // System.PlatformNotSupportedException: // The Web application is running under IIS 7 in Integrated mode. public static void ProcessRequest(HttpWorkerRequest wr);
-
博客地址:http://www.cnblogs.com/wolf-sun/
博客版权:如果文中有不妥或者错误的地方还望高手的你指出,以免误人子弟。如果觉得本文对你有所帮助不如【推荐】一下!如果你有更好的建议,不如留言一起讨论,共同进步! 再次感谢您耐心的读完本篇文章。
分类:
[Asp.net本质论笔记]
标签:
HttpRuntime
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
2014-02-24 [Asp.net]Uploadify所有配置说明,常见bug问题分析