Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HttpRequest Class [IIS 7 and higher]

IIS 7.0

Represents an HTTP request in a worker process.

class HttpRequest : Object

This class contains no methods.

The following table lists the properties exposed by the HttpRequest class.

Name

Description

ClientIPAddress

A read-only string value that contains the IP address of the client that made the request.

ConnectionId

A read-only string value that contains a 128-bit GUID that uniquely identifies a request's connection.

CurrentModule

A read-only string value that contains the name of the current module that the request is in.

HostName

A read-only string value that contains the site domain name or computer name requested by the client.

GUID

A read-only string value that contains a 128-bit GUID that uniquely identifies a request. The only key property.

LocalIPAddress

A read-only string value that contains the IP address of the network adapter on which the request was received.

LocalPort

A read-only uint32 value that contains the port number on which the request was received.

PipelineState

A read-only uint32 value that contains the pipeline module state that the request is in. The possible values are listed in Request-Processing Constants.

SiteId

A read-only uint32 value that contains the site ID of the request.

TimeElapsed

A read-only uint32 value that contains the period of time, in milliseconds, that the request has been in process.

TimeInModule

A read-only uint32 value that contains the period of time, in milliseconds, that the request has been in the module in which it is currently located.

TimeInState

A read-only uint32 value that contains the period of time, in milliseconds, that the request has been in the current request notification.

Url

A read-only string value that contains the requested URL.

Verb

A read-only string value that contains the HTTP verb used in the request.

This class contains no subclasses.

The following example lists all the properties for each currently executing request on a Web server.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the worker processes.
Set oW3WPs = oWebAdmin.InstancesOf("WorkerProcess")

For Each oW3WP In oW3WPs

    ' Get the requests queued for an individual worker process and
    ' place them in an array.
    oW3WP.GetExecutingRequests arrReqs

    ' Show the number of requests queued.
    If IsNull(arrReqs) Then
                WScript.Echo "No currently executing requests."
    Else

        WScript.Echo "Number of currently executing requests: " & _
            UBound(arrReqs) + 1
        WScript.Echo
    
        For Each oRequest In arrReqs
            WScript.Echo "ClientIPAddress: " & oRequest.ClientIPAddress
            WScript.Echo "ConnectionId: " & oRequest.ConnectionId
            WScript.Echo "CurrentModule: " & oRequest.CurrentModule
            WScript.Echo "GUID: "  &  oRequest.GUID
            WScript.Echo "HostName: " & oRequest.HostName
            WScript.Echo "LocalIPAddress: " &  oRequest.LocalIPAddress
            WScript.Echo "LocalPort: " &  oRequest.LocalPort
            WScript.Echo "PipelineState: " &  oRequest.PipelineState
            WScript.Echo "Site ID: " &  oRequest.SiteID
            WScript.Echo "TimeElapsed: " &  oRequest.TimeElapsed
            WScript.Echo "TimeInModule: " &  oRequest.TimeInModule
            WScript.Echo "TimeInState: " &  oRequest.TimeInState
            WScript.Echo "Url: "  & oRequest.Url
            WScript.Echo "Verb: " &  oRequest.Verb
            WScript.Echo
        Next
    End If
Next

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show:
© 2015 Microsoft