IHttpContext Interface

IIS 7.0
 

Defines an object that represents the processing context for request-level operations.

class IHttpContext

The following table lists the methods exposed by the IHttpContext class.

Name

Description

AllocateRequestMemory

Allocates a specified amount of memory.

CancelIo

Cancels any pending send or receive operations.

CloneContext

Creates a clone of the current request context.

DisableNotifications

Disables specific notifications that are pending for this request in the current module.

ExecuteRequest

Executes a child request.

GetApplication

Retrieves the application container for the current context.

GetConnection

Retrieves the connection container for the current context.

GetCurrentExecutionStats

Retrieves the execution statistics for the current context.

GetExecuteFlags

Retrieves the execution flags for the current context.

GetFileInfo

Retrieves the file information container for the current context.

GetIsLastNotification

Indicates whether more notifications are pending for this request within the current module host.

GetMetadata

Retrieves the metadata container for the current request context.

GetModuleContextContainer

Retrieves the module context container for the current context.

GetNextNotification

Retrieves the next notification for the current module host.

GetParentContext

Retrieves a pointer to the parent context for the current context.

GetPhysicalPath

Retrieves the physical path for the current request.

GetRequest

Returns the HTTP request container for the current context.

GetResponse

Returns the HTTP response container for the current context.

GetResponseHeadersSent

Determines whether the HTTP response headers have been sent to the client.

GetRootContext

Retrieves a pointer to the root context for the current context.

GetScriptMap

Retrieves the script map container for the current context.

GetScriptName

Retrieves the URL for the current request.

GetScriptTranslated

Retrieves the physical path of the current request.

GetServerVarChanges

Retrieves the changes to the server variables for the current context.

GetServerVariable

Retrieves a specific server variable.

GetSite

Retrieves the site information container for the current context.

GetTraceContext

Retrieves the trace context container for the current context.

GetUrlInfo

Retrieves the URL information container for the current context.

GetUser

Retrieves the user information container for the current context.

IndicateCompletion

Indicates the completion of asynchronous work and requests IIS to resume execution on the calling thread.

MapHandler

Maps a handler for a give URL, HTTP verb pair on a site.

MapPath

Returns the physical path of a relative URL.

NotifyCustomNotification

Raises a custom request-level notification.

PostCompletion

Indicates the completion of asynchronous work and requests IIS to queue execution to the thread pool.

ReleaseClonedContext

Releases a cloned IHttpContext instance.

SetRequestHandled

Indicates that the handlers for the current request have completed.

SetServerVariable

Sets a server variable to a specified value.

Name

Description

IHttpContext2

Represents the reprocessing of an HTTP request and enables the retrieval of information about the original user during asynchronous operation.

IHttpContext3

Represents the reprocessing of an HTTP request and enables additional support for asynchronous operations.

IHttpContext4

Represents the reprocessing of an HTTP request and enables additional support for diagnostic operations.

The IHttpContext interface represents the main programmatic interface for HTTP modules to access information about the current request-level context. This interface retrieves several additional interfaces that you can use when writing HTTP modules.

For example, the GetRequest and GetResponse methods retrieve, respectively, the IHttpRequest and IHttpResponse interfaces for the current context. These interfaces allow developers to access or modify the request body and response body, HTTP headers, server behavior, and so on.

IIS 7 allows you to create and execute child contexts through the IHttpContext interface by using the CloneContext, ExecuteRequest, and ReleaseClonedContext methods. IIS also provides the GetParentContext and GetRootContext methods to help developers write HTTP modules that can change behavior depending on whether the current context is a root, child, or parent context.

IHttpContext also provides several methods to help developers control the behavior of notifications. For example, you can use the DisableNotifications method to disable notifications or the GetIsLastNotification method to determine whether there are any remaining notifications. Additionally, you can use the GetNextNotification method to merge notifications or the NotifyCustomNotification method to raise a custom notification.

Requirements

Type

Description

Client

  • IIS 7.0 on Windows Vista

  • IIS 7.5 on Windows 7

  • IIS 8.0 on Windows 8

  • IIS 10.0 on Windows 10

Server

  • IIS 7.0 on Windows Server 2008

  • IIS 7.5 on Windows Server 2008 R2

  • IIS 8.0 on Windows Server 2012

  • IIS 8.0 on Windows Server 2012 R2

  • IIS 10.0 on Windows Server 2016 Technical Preview

Product

  • IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0

  • IIS Express 7.5, IIS Express 8.0, IIS Express 10.0

Header

Httpserv.h

Show: