HttpRuntime Classe
Definição
Fornece um conjunto de serviços de tempo de execução do ASP.NET para o aplicativo atual.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
- Herança
-
HttpRuntime
Exemplos
O exemplo a seguir demonstra como obter propriedades da HttpRuntime classe que representa o domínio do aplicativo atual e exibi-las para o navegador.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>
Comentários
O HttpRuntime objeto é usado no início do modelo de pipeline ASP.NET que processa solicitações HTTP.The HttpRuntime object is used at the beginning of the ASP.NET pipeline model that processes HTTP requests. O ProcessRequest método orienta todo o processamento da Web ASP.net subsequente.The ProcessRequest method drives all subsequent ASP.NET Web processing.
Os desenvolvedores de páginas podem usar as HttpRuntime Propriedades de classe para descobrir informações sobre o domínio do aplicativo atual para fins de diagnóstico, por exemplo.Page developers can use the HttpRuntime class properties to find out information about the current application domain for diagnostic purposes, for example. Os desenvolvedores que criam um pipeline de processo personalizado ou um ambiente de hospedagem personalizado devem chamar o ProcessRequest método de uma classe derivada da HttpWorkerRequest SimpleWorkerRequest classe ou.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.
Construtores
| HttpRuntime() |
Inicializa uma nova instância da classe HttpRuntime.Initializes a new instance of the HttpRuntime class. |
Propriedades
| AppDomainAppId |
Obtém a identificação do aplicativo do domínio do aplicativo no qual o HttpRuntime está localizado.Gets the application identification of the application domain where the HttpRuntime exists. |
| AppDomainAppPath |
Obtém o caminho do disco físico do diretório do aplicativo para o aplicativo hospedado no domínio de aplicativo atual.Gets the physical drive path of the application directory for the application hosted in the current application domain. |
| AppDomainAppVirtualPath |
Obtém o caminho virtual do diretório que contém o aplicativo hospedado no domínio do aplicativo atual.Gets the virtual path of the directory that contains the application hosted in the current application domain. |
| AppDomainId |
Obtém a identificação do domínio do aplicativo no qual a instância de HttpRuntime está localizada.Gets the domain identification of the application domain where the HttpRuntime instance exists. |
| AspClientScriptPhysicalPath |
Obtém o caminho da pasta para os arquivos de script de cliente do ASP.NET.Gets the folder path for the ASP.NET client script files. |
| AspClientScriptVirtualPath |
Obtém o caminho virtual para os arquivos de script de cliente do ASP.NET.Gets the virtual path for the ASP.NET client script files. |
| AspInstallDirectory |
Obtém o caminho físico do diretório em que os arquivos executáveis do ASP.NET estão instalados.Gets the physical path of the directory where the ASP.NET executable files are installed. |
| BinDirectory |
Obtém o caminho físico para o diretório /bin do aplicativo atual.Gets the physical path to the /bin directory for the current application. |
| Cache |
Obtém o Cache para o aplicativo atual.Gets the Cache for the current application. |
| ClrInstallDirectory |
Obtém o caminho físico para o diretório em que os arquivos executáveis do Common Language Runtime estão instalados.Gets the physical path to the directory where the common language runtime executable files are installed. |
| CodegenDir |
Obtém o caminho físico para o diretório em que o ASP.NET armazena arquivos temporários (fontes geradas, assemblies compilados e assim por diante) do aplicativo atual.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 |
Obtém a versão do IIS que está hospedando esse aplicativo.Gets the version of IIS that is hosting this application. |
| IsOnUNCShare |
Obtém um valor que indica se o aplicativo é mapeado para um compartilhamento UNC.Gets a value that indicates whether the application is mapped to a universal naming convention (UNC) share. |
| MachineConfigurationDirectory |
Obtém o caminho físico para o diretório em que o arquivo Machine.config para o aplicativo atual está localizado.Gets the physical path to the directory where the Machine.config file for the current application is located. |
| TargetFramework |
Obtém a versão do .NET Framework que o aplicativo Web atual visa.Gets the version of the .NET Framework that the current web application targets. |
| UsingIntegratedPipeline |
Obtém um valor que indica se o aplicativo atual está sendo executado no modo de pipeline integrado do IIS 7,0.Gets a value that indicates whether the current application is running in the integrated-pipeline mode of IIS 7.0. |
| WebObjectActivator |
Obtém ou define a instância de IServiceProvider para suporte à injeção de dependência.Gets or sets the IServiceProvider instance for dependency injection support. |
Métodos
| Close() |
Desliga a instância de HttpRuntime.Shuts down the HttpRuntime instance. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetNamedPermissionSet() |
Retorna o conjunto de permissões associadas a grupos de código.Returns the set of permissions associated with code groups. |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ProcessRequest(HttpWorkerRequest) |
Conduz toda a execução de processamento da Web do ASP.NET.Drives all ASP.NET Web processing execution. |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |
| UnloadAppDomain() |
Encerra o aplicativo atual.Terminates the current application. O aplicativo será reiniciado na próxima vez em que uma solicitação for recebida para ele.The application restarts the next time a request is received for it. |