HttpRuntime Class

 

Provides a set of ASP.NET run-time services for the current application.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

System.Object
  System.Web.HttpRuntime

Public NotInheritable Class HttpRuntime

NameDescription
System_CAPS_pubmethodHttpRuntime()

Initializes a new instance of the HttpRuntime class.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticAppDomainAppId

Gets the application identification of the application domain where the HttpRuntime exists.

System_CAPS_pubpropertySystem_CAPS_staticAppDomainAppPath

Gets the physical drive path of the application directory for the application hosted in the current application domain.

System_CAPS_pubpropertySystem_CAPS_staticAppDomainAppVirtualPath

Gets the virtual path of the directory that contains the application hosted in the current application domain.

System_CAPS_pubpropertySystem_CAPS_staticAppDomainId

Gets the domain identification of the application domain where the HttpRuntime instance exists.

System_CAPS_pubpropertySystem_CAPS_staticAspClientScriptPhysicalPath

Gets the folder path for the ASP.NET client script files.

System_CAPS_pubpropertySystem_CAPS_staticAspClientScriptVirtualPath

Gets the virtual path for the ASP.NET client script files.

System_CAPS_pubpropertySystem_CAPS_staticAspInstallDirectory

Gets the physical path of the directory where the ASP.NET executable files are installed.

System_CAPS_pubpropertySystem_CAPS_staticBinDirectory

Gets the physical path to the /bin directory for the current application.

System_CAPS_pubpropertySystem_CAPS_staticCache

Gets the Cache for the current application.

System_CAPS_pubpropertySystem_CAPS_staticClrInstallDirectory

Gets the physical path to the directory where the common language runtime executable files are installed.

System_CAPS_pubpropertySystem_CAPS_staticCodegenDir

Gets the physical path to the directory where ASP.NET stores temporary files (generated sources, compiled assemblies, and so on) for the current application.

System_CAPS_pubpropertySystem_CAPS_staticIISVersion

Gets the version of IIS that is hosting this application.

System_CAPS_pubpropertySystem_CAPS_staticIsOnUNCShare

Gets a value that indicates whether the application is mapped to a universal naming convention (UNC) share.

System_CAPS_pubpropertySystem_CAPS_staticMachineConfigurationDirectory

Gets the physical path to the directory where the Machine.config file for the current application is located.

System_CAPS_pubpropertySystem_CAPS_staticTargetFramework

Gets the version of the .NET Framework that the current web application targets.

System_CAPS_pubpropertySystem_CAPS_staticUsingIntegratedPipeline

Gets a value that indicates whether the current application is running in the integrated-pipeline mode of IIS 7.0.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticClose()

Shuts down the HttpRuntime instance.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetNamedPermissionSet()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns the set of permissions associated with code groups.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticProcessRequest(HttpWorkerRequest)

Drives all ASP.NET Web processing execution.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticUnloadAppDomain()

Terminates the current application. The application restarts the next time a request is received for it.

The HttpRuntime object is used at the beginning of the ASP.NET pipeline model that processes HTTP requests. The ProcessRequest method drives all subsequent ASP.NET Web processing.

Page developers can use the HttpRuntime class properties to find out information about the current application domain for diagnostic purposes, for example. 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.

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="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>

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: