HttpRuntime Класс
Определение
Предоставляет набор исполняемых служб ASP.NET для текущего приложения.Provides a set of ASP.NET run-time services for the current application.
public ref class HttpRuntime sealed
public sealed class HttpRuntime
type HttpRuntime = class
Public NotInheritable Class HttpRuntime
- Наследование
-
HttpRuntime
Примеры
В следующем примере показано, как получить свойства HttpRuntime класса, представляющего текущий домен приложения, и отобразить их в браузере.The following example demonstrates how to get properties of the HttpRuntime class representing the current application domain and display them to the browser.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(Object sender, System.EventArgs e)
{
StringBuilder sb = new StringBuilder();
String nl = "<br />";
sb.Append("AppDomainAppId = " +
HttpRuntime.AppDomainAppId + nl);
sb.Append("AppDomainAppPath = " +
HttpRuntime.AppDomainAppPath + nl);
sb.Append("AppDomainAppVirtualPath = " +
HttpRuntime.AppDomainAppVirtualPath + nl);
sb.Append("AppDomainId = " +
HttpRuntime.AppDomainId + nl);
sb.Append("AspInstallDirectory = " +
HttpRuntime.AspInstallDirectory + nl);
sb.Append("BinDirectory = " +
HttpRuntime.BinDirectory + nl);
sb.Append("ClrInstallDirectory = " +
HttpRuntime.ClrInstallDirectory + nl);
sb.Append("CodegenDir = " +
HttpRuntime.CodegenDir + nl);
sb.Append("IsOnUNCShare = " +
HttpRuntime.IsOnUNCShare.ToString() + nl);
sb.Append("MachineConfigurationDirectory = " +
HttpRuntime.MachineConfigurationDirectory + nl);
label1.Text = sb.ToString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HttpRuntime Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:label id="label1" runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim sb As New StringBuilder()
Dim nl As String = "<br />"
sb.Append("AppDomainAppId = " & _
HttpRuntime.AppDomainAppId & nl)
sb.Append("AppDomainAppPath = " & _
HttpRuntime.AppDomainAppPath & nl)
sb.Append("AppDomainAppVirtualPath = " & _
HttpRuntime.AppDomainAppVirtualPath & nl)
sb.Append("AppDomainId = " & _
HttpRuntime.AppDomainId & nl)
sb.Append("AspInstallDirectory = " & _
HttpRuntime.AspInstallDirectory & nl)
sb.Append("BinDirectory = " & _
HttpRuntime.BinDirectory & nl)
sb.Append("ClrInstallDirectory = " & _
HttpRuntime.ClrInstallDirectory & nl)
sb.Append("CodegenDir = " & _
HttpRuntime.CodegenDir & nl)
sb.Append("IsOnUNCShare = " & _
HttpRuntime.IsOnUNCShare.ToString() & nl)
sb.Append("MachineConfigurationDirectory = " & _
HttpRuntime.MachineConfigurationDirectory & nl)
label1.Text = sb.ToString()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HttpRuntime Example</title>
</head>
<body>
<form id="Form1" runat="server">
<asp:label id="label1" runat="server"/>
</form>
</body>
</html>
Комментарии
HttpRuntime Объект используется в начале модели конвейера ASP.NET, обрабатывающей HTTP-запросы.The HttpRuntime object is used at the beginning of the ASP.NET pipeline model that processes HTTP requests. ProcessRequest Метод управляет всеми последующими веб-обработкой ASP.NET.The ProcessRequest method drives all subsequent ASP.NET Web processing.
Разработчики страниц могут использовать HttpRuntime свойства класса для поиска сведений о текущем домене приложения в целях диагностики, например.Page developers can use the HttpRuntime class properties to find out information about the current application domain for diagnostic purposes, for example. Разработчики, создающие пользовательский конвейер процесса или пользовательскую среду размещения, ProcessRequest должны вызывать метод из класса, производного SimpleWorkerRequest HttpWorkerRequest от класса или.Developers creating custom process pipeline or a custom hosting environment should call the ProcessRequest method from a class derived from the HttpWorkerRequest or SimpleWorkerRequest class.
Конструкторы
HttpRuntime() |
Инициализирует новый экземпляр класса HttpRuntime.Initializes a new instance of the HttpRuntime class. |
Свойства
AppDomainAppId |
Возвращает идентификацию домена приложения, в котором располагается HttpRuntime.Gets the application identification of the application domain where the HttpRuntime exists. |
AppDomainAppPath |
Возвращает путь к физическому диску с каталогом приложения для доступа к приложению, размещенному в текущем домене приложения.Gets the physical drive path of the application directory for the application hosted in the current application domain. |
AppDomainAppVirtualPath |
Возвращает виртуальный путь к каталогу, в котором содержится приложение, размещенное в текущем домене приложения.Gets the virtual path of the directory that contains the application hosted in the current application domain. |
AppDomainId |
Получает идентификацию домена приложения, в котором имеется экземпляр класса HttpRuntime.Gets the domain identification of the application domain where the HttpRuntime instance exists. |
AspClientScriptPhysicalPath |
Возвращает путь к папке для файлов клиентского скрипта ASP.NET.Gets the folder path for the ASP.NET client script files. |
AspClientScriptVirtualPath |
Возвращает виртуальный путь к папке для файлов клиентского скрипта ASP.NET.Gets the virtual path for the ASP.NET client script files. |
AspInstallDirectory |
Возвращает физический путь к каталогу, в который установлены исполняемые файлы ASP.NET.Gets the physical path of the directory where the ASP.NET executable files are installed. |
BinDirectory |
Возвращает физический путь к каталогу /bin для текущего приложения.Gets the physical path to the /bin directory for the current application. |
Cache |
Возвращает объект Cache для текущего приложения.Gets the Cache for the current application. |
ClrInstallDirectory |
Возвращает физический путь к каталогу, в котором установлены исполняемые файлы среды CLR.Gets the physical path to the directory where the common language runtime executable files are installed. |
CodegenDir |
Возвращает физический путь к каталогу, в котором хранятся временные файлы ASP.NET (исходные файлы, компилируемые сборки и т. д.) для текущего приложения.Gets the physical path to the directory where ASP.NET stores temporary files (generated sources, compiled assemblies, and so on) for the current application. |
IISVersion |
Получает версию служб IIS, где размещается это приложение.Gets the version of IIS that is hosting this application. |
IsOnUNCShare |
Возвращает значение, указывающее, сопоставлено ли приложение с общим ресурсом UNC.Gets a value that indicates whether the application is mapped to a universal naming convention (UNC) share. |
MachineConfigurationDirectory |
Возвращает физический путь к каталогу, в котором помещен файл Machine.config текущего приложения.Gets the physical path to the directory where the Machine.config file for the current application is located. |
TargetFramework |
Получает версию .NET Framework, на которую ориентировано текущее веб-приложение.Gets the version of the .NET Framework that the current web application targets. |
UsingIntegratedPipeline |
Получает значение, указывающее, работает ли текущее приложение в режиме интегрированного конвейера IIS 7.0IIS 7.0.Gets a value that indicates whether the current application is running in the integrated-pipeline mode of IIS 7.0IIS 7.0. |
WebObjectActivator |
Получает или устанавливает экземпляр IServiceProvider для поддержки введения зависимостей.Gets or sets the IServiceProvider instance for dependency injection support. |
Методы
Close() |
Завершает работу экземпляра HttpRuntime.Shuts down the HttpRuntime instance. |
Equals(Object) |
Определяет, равен ли указанный объект текущему объекту.Determines whether the specified object is equal to the current object. (Унаследовано от Object) |
GetHashCode() |
Служит в качестве хэш-функции по умолчанию.Serves as the default hash function. (Унаследовано от Object) |
GetNamedPermissionSet() |
Возвращает набор разрешений. связанных с группами кодов.Returns the set of permissions associated with code groups. |
GetType() |
Возвращает объект Type для текущего экземпляра.Gets the Type of the current instance. (Унаследовано от Object) |
MemberwiseClone() |
Создает неполную копию текущего объекта Object.Creates a shallow copy of the current Object. (Унаследовано от Object) |
ProcessRequest(HttpWorkerRequest) |
Управляет выполнением всеми процессами веб-обработки ASP.NET.Drives all ASP.NET Web processing execution. |
ToString() |
Возвращает строку, представляющую текущий объект.Returns a string that represents the current object. (Унаследовано от Object) |
UnloadAppDomain() |
Завершает работу текущего приложения.Terminates the current application. При следующем запуске приложения выполняется полученный запрос.The application restarts the next time a request is received for it. |