HttpRuntime应用程序运行时

2021-05-13 07:27

阅读:728

标签:work   dir   客户   alt   blog   null   gen   ext   客户端   

System.Web.HttpRuntime类是整个Asp.net服务器处理的入口。

这个类提供了一系列的静态属性,反映web应用程序域的设置信息,而且每个web应用程序域中存在一个System.Web.Runtime类。

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Web;
 6 using System.Web.UI;
 7 using System.Web.UI.WebControls;
 8 
 9 namespace HttpRuntimeDemo
10 {
11     public partial class _default : System.Web.UI.Page
12     {
13         protected void Page_Load(object sender, EventArgs e)
14         {
15             StringBuilder sb = new StringBuilder();
16             //应用程序域id
17             sb.AppendFormat("AppDomainAppId:{0}
", HttpRuntime.AppDomainAppId); 18 //web应用程序所在文件目录 19 sb.AppendFormat("AppDomainAppPath:{0}
", HttpRuntime.AppDomainAppPath); 20 //web应用程序的虚拟目录 21 sb.AppendFormat("AppDomainAppVirtualPath:{0}
", HttpRuntime.AppDomainAppVirtualPath); 22 //客户端脚本在服务器上的文件目录 23 sb.AppendFormat("AspClientScriptPhysicalPath:{0}
", HttpRuntime.AspClientScriptPhysicalPath); 24 //客户端脚本在服务器上的虚拟目录 25 sb.AppendFormat("AspClientScriptPhysicalPath:{0}
", HttpRuntime.AspClientScriptVirtualPath); 26 //asp.net安装目录 27 sb.AppendFormat("AspInstallDirectory:{0}
", HttpRuntime.AspInstallDirectory); 28 //bin目录 29 sb.AppendFormat("BinDirectory:{0}
", HttpRuntime.BinDirectory); 30 //clr安装目录 31 sb.AppendFormat("ClrInstallDirectory:{0}
", HttpRuntime.ClrInstallDirectory); 32 //生成代码的目录 33 sb.AppendFormat("CodegenDir:{0}
", HttpRuntime.CodegenDir); 34 //iss版本 35 sb.AppendFormat("IISVersion:{0}
", HttpRuntime.IISVersion.MajorRevision.ToString()); 36 //本机配置文件所在的目录 37 sb.AppendFormat("MachineConfigurationDirectory:{0}
", HttpRuntime.MachineConfigurationDirectory); 38 //是否使用iis7集成模式 39 sb.AppendFormat("UsingIntegratedPipeline:{0}
", HttpRuntime.UsingIntegratedPipeline.ToString()); 40 // Summary: 41 // Gets a value that indicates whether the application is mapped to a universal 42 // naming convention (UNC) share. 43 sb.AppendFormat("IsOnUNCShare:{0}
", HttpRuntime.IsOnUNCShare.ToString()); 44 Response.Write(sb.ToString()); 45 46 } 47 } 48 }

上面列出了HttpRuntime主要的几个静态属性,输出结果为:

技术图片

而HttpRuntime的静态方法ProcessRequest将帮助我们处理Http请求。

 1 //
 2         // Summary:
 3         //     Drives all ASP.NET Web processing execution.
 4         //
 5         // Parameters:
 6         //   wr:
 7         //     An System.Web.HttpWorkerRequest for the current application.
 8         //
 9         // Exceptions:
10         //   System.ArgumentNullException:
11         //     The wr parameter is null.
12         //
13         //   System.PlatformNotSupportedException:
14         //     The Web application is running under IIS 7 in Integrated mode.
15         public static void ProcessRequest(HttpWorkerRequest wr);

转:https://www.cnblogs.com/wolf-sun/p/5199315.html

HttpRuntime应用程序运行时

标签:work   dir   客户   alt   blog   null   gen   ext   客户端   

原文地址:https://www.cnblogs.com/fanfan-90/p/12001963.html


评论


亲,登录后才可以留言!