Export (0) Print
Expand All

SimpleWorkerRequest Class

Provides a simple implementation of the HttpWorkerRequest abstract class that can be used to host ASP.NET applications outside an Internet Information Services (IIS) application. You can employ SimpleWorkerRequest directly or extend it.

System.Object
  System.Web.HttpWorkerRequest
    System.Web.Hosting.SimpleWorkerRequest

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

[ComVisibleAttribute(false)]
public class SimpleWorkerRequest : HttpWorkerRequest

The SimpleWorkerRequest type exposes the following members.

  NameDescription
Public methodSimpleWorkerRequest(String, String, TextWriter)Initializes a new instance of the SimpleWorkerRequest class when the target application domain has been created using the CreateApplicationHost method.
Public methodSimpleWorkerRequest(String, String, String, String, TextWriter)Initializes a new instance of the SimpleWorkerRequest class for use in an arbitrary application domain, when the user code creates an HttpContext (passing the SimpleWorkerRequest as an argument to the HttpContext constructor).
Top

  NameDescription
Public propertyMachineConfigPathGets the full physical path to the Machine.config file. (Overrides HttpWorkerRequest.MachineConfigPath.)
Public propertyMachineInstallDirectoryGets the physical path to the directory where the ASP.NET binaries are installed. (Overrides HttpWorkerRequest.MachineInstallDirectory.)
Public propertyRequestTraceIdentifierGets the corresponding Event Tracking for Windows trace ID for the current request. (Inherited from HttpWorkerRequest.)
Public propertyRootWebConfigPathGets the full physical path to the root Web.config file. (Overrides HttpWorkerRequest.RootWebConfigPath.)
Public propertySupportsAsyncFlushGets a value that indicates whether asynchronous flush operations are supported. (Inherited from HttpWorkerRequest.)
Public propertySupportsAsyncReadGets a value that indicates whether asynchronous read operations are supported. (Inherited from HttpWorkerRequest.)
Top

  NameDescription
Public methodBeginFlushSends the currently buffered response to the client. (Inherited from HttpWorkerRequest.)
Public methodBeginReadBegins an asynchronous read operation of the request entity body. (Inherited from HttpWorkerRequest.)
Public methodCloseConnectionTerminates the connection with the client. (Inherited from HttpWorkerRequest.)
Public methodEndFlushWaits for the pending asynchronous flush operation to complete. (Inherited from HttpWorkerRequest.)
Public methodEndOfRequestNotifies the HttpWorkerRequest that request processing for the current request is complete. (Overrides HttpWorkerRequest.EndOfRequest().)
Public methodEndReadWaits for the pending asynchronous read operation to complete. (Inherited from HttpWorkerRequest.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFlushResponseSends all pending response data to the client. (Overrides HttpWorkerRequest.FlushResponse(Boolean).)
Public methodGetAppPathReturns the virtual path to the currently executing server application. (Overrides HttpWorkerRequest.GetAppPath().)
Public methodGetAppPathTranslatedReturns the UNC-translated path to the currently executing server application. (Overrides HttpWorkerRequest.GetAppPathTranslated().)
Public methodGetAppPoolIDInfrastructure. When overridden in a derived class, returns the application pool ID for the current URL. (Inherited from HttpWorkerRequest.)
Public methodGetBytesReadInfrastructure. Gets the number of bytes read in from the client. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificateInfrastructure. When overridden in a derived class, gets the certification fields (specified in the X.509 standard) from a request issued by the client. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificateBinaryIssuerInfrastructure. Gets the certificate issuer, in binary format. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificateEncodingInfrastructure. When overridden in a derived class, returns the Encoding object in which the client certificate was encoded. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificatePublicKeyInfrastructure. When overridden in a derived class, gets a PublicKey object associated with the client certificate. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificateValidFromInfrastructure. When overridden in a derived class, gets the date when the certificate becomes valid. The date varies with international settings. (Inherited from HttpWorkerRequest.)
Public methodGetClientCertificateValidUntilInfrastructure. Gets the certificate expiration date. (Inherited from HttpWorkerRequest.)
Public methodGetConnectionIDInfrastructure. When overridden in a derived class, returns the ID of the current connection. (Inherited from HttpWorkerRequest.)
Public methodGetFilePathReturns the physical path to the requested URI. (Overrides HttpWorkerRequest.GetFilePath().)
Public methodGetFilePathTranslatedReturns the physical file path to the requested URI (and translates it from virtual path to physical path: for example, "/proj1/page.aspx" to "c:\dir\page.aspx") (Overrides HttpWorkerRequest.GetFilePathTranslated().)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetHttpVerbNameReturns the HTTP request verb. (Overrides HttpWorkerRequest.GetHttpVerbName().)
Public methodGetHttpVersionReturns the HTTP version string of the request (for example, "HTTP/1.1"). (Overrides HttpWorkerRequest.GetHttpVersion().)
Public methodGetKnownRequestHeaderReturns the standard HTTP request header that corresponds to the specified index. (Inherited from HttpWorkerRequest.)
Public methodGetLocalAddressReturns the server IP address of the interface on which the request was received. (Overrides HttpWorkerRequest.GetLocalAddress().)
Public methodGetLocalPortReturns the port number on which the request was received. (Overrides HttpWorkerRequest.GetLocalPort().)
Public methodGetPathInfoReturns additional path information for a resource with a URL extension. That is, for the path /virdir/page.html/tail, the return value is /tail. (Overrides HttpWorkerRequest.GetPathInfo().)
Public methodGetPreloadedEntityBody()Returns the portion of the HTTP request body that has already been read. (Inherited from HttpWorkerRequest.)
Public methodGetPreloadedEntityBody(Byte[], Int32)Gets the portion of the HTTP request body that has currently been read by using the specified buffer data and byte offset. (Inherited from HttpWorkerRequest.)
Public methodGetPreloadedEntityBodyLengthGets the length of the portion of the HTTP request body that has currently been read. (Inherited from HttpWorkerRequest.)
Public methodGetProtocolWhen overridden in a derived class, returns the HTTP protocol (HTTP or HTTPS). (Inherited from HttpWorkerRequest.)
Public methodGetQueryStringReturns the query string specified in the request URL. (Overrides HttpWorkerRequest.GetQueryString().)
Public methodGetQueryStringRawBytesWhen overridden in a derived class, returns the response query string as an array of bytes. (Inherited from HttpWorkerRequest.)
Public methodGetRawUrlReturns the URL path contained in the header with the query string appended. (Overrides HttpWorkerRequest.GetRawUrl().)
Public methodGetRemoteAddressReturns the IP address of the client. (Overrides HttpWorkerRequest.GetRemoteAddress().)
Public methodGetRemoteNameWhen overridden in a derived class, returns the name of the client computer. (Inherited from HttpWorkerRequest.)
Public methodGetRemotePortReturns the client's port number. (Overrides HttpWorkerRequest.GetRemotePort().)
Public methodGetRequestReasonInfrastructure. When overridden in a derived class, returns the reason for the request. (Inherited from HttpWorkerRequest.)
Public methodGetServerNameWhen overridden in a derived class, returns the name of the local server. (Inherited from HttpWorkerRequest.)
Public methodGetServerVariableReturns a single server variable from a dictionary of server variables associated with the request. (Overrides HttpWorkerRequest.GetServerVariable(String).)
Public methodGetTotalEntityBodyLengthGets the length of the entire HTTP request body. (Inherited from HttpWorkerRequest.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetUnknownRequestHeaderReturns a nonstandard HTTP request header value. (Inherited from HttpWorkerRequest.)
Public methodGetUnknownRequestHeadersGet all nonstandard HTTP header name-value pairs. (Inherited from HttpWorkerRequest.)
Public methodGetUriPathReturns the virtual path to the requested URI. (Overrides HttpWorkerRequest.GetUriPath().)
Public methodGetUrlContextIDInfrastructure. When overridden in a derived class, returns the context ID of the current connection. (Inherited from HttpWorkerRequest.)
Public methodGetUserTokenReturns the client's impersonation token. (Overrides HttpWorkerRequest.GetUserToken().)
Public methodGetVirtualPathTokenInfrastructure. Gets the impersonation token for the request virtual path. (Inherited from HttpWorkerRequest.)
Public methodHasEntityBodyReturns a value indicating whether the request contains body data. (Inherited from HttpWorkerRequest.)
Public methodHeadersSentReturns a value indicating whether HTTP response headers have been sent to the client for the current request. (Inherited from HttpWorkerRequest.)
Public methodIsClientConnectedReturns a value indicating whether the client connection is still active. (Inherited from HttpWorkerRequest.)
Public methodIsEntireEntityBodyIsPreloadedReturns a value indicating whether all request data is available and no further reads from the client are required. (Inherited from HttpWorkerRequest.)
Public methodIsSecureReturns a value indicating whether the connection uses SSL. (Inherited from HttpWorkerRequest.)
Public methodMapPathReturns the physical path corresponding to the specified virtual path. (Overrides HttpWorkerRequest.MapPath(String).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReadEntityBody(Byte[], Int32)Reads request data from the client (when not preloaded). (Inherited from HttpWorkerRequest.)
Public methodReadEntityBody(Byte[], Int32, Int32)Reads request data from the client (when not preloaded) by using the specified buffer to read from, byte offset, and maximum bytes. (Inherited from HttpWorkerRequest.)
Public methodSendCalculatedContentLength(Int32)Adds a Content-Length HTTP header to the response for message bodies that are less than or equal to 2 GB. (Inherited from HttpWorkerRequest.)
Public methodSendCalculatedContentLength(Int64)Adds a Content-Length HTTP header to the response for message bodies that are greater than 2 GB. (Inherited from HttpWorkerRequest.)
Public methodSendKnownResponseHeaderAdds a standard HTTP header to the response. (Overrides HttpWorkerRequest.SendKnownResponseHeader(Int32, String).)
Public methodSendResponseFromFile(IntPtr, Int64, Int64)Adds the contents of the file with the specified handle to the response and specifies the starting position in the file and the number of bytes to send. (Overrides HttpWorkerRequest.SendResponseFromFile(IntPtr, Int64, Int64).)
Public methodSendResponseFromFile(String, Int64, Int64)Adds the contents of the file with the specified name to the response and specifies the starting position in the file and the number of bytes to send. (Overrides HttpWorkerRequest.SendResponseFromFile(String, Int64, Int64).)
Public methodSendResponseFromMemory(Byte[], Int32)Adds the contents of a byte array to the response and specifies the number of bytes to send. (Overrides HttpWorkerRequest.SendResponseFromMemory(Byte[], Int32).)
Public methodSendResponseFromMemory(IntPtr, Int32)Adds the specified number of bytes from a block of memory to the response. (Inherited from HttpWorkerRequest.)
Public methodSendStatusSpecifies the HTTP status code and status description of the response; for example, SendStatus(200, "Ok"). (Overrides HttpWorkerRequest.SendStatus(Int32, String).)
Public methodSendUnknownResponseHeaderAdds a nonstandard HTTP header to the response. (Overrides HttpWorkerRequest.SendUnknownResponseHeader(String, String).)
Public methodSetEndOfSendNotificationRegisters for an optional notification when all the response data is sent. (Inherited from HttpWorkerRequest.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This simple implementation of HttpWorkerRequest provides the request URL and the query string and captures the body of the output into a TextWriter. To achieve richer functionality, such as providing posted content and headers and capturing the response headers or response body as binary data, you should extend SimpleWorkerRequest and override the appropriate HttpWorkerRequest methods.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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