HttpWorkerRequest 类

定义

此抽象类定义由 ASP.NET 托管代码用于处理请求的基本辅助方法和枚举。This abstract class defines the base worker methods and enumerations used by ASP.NET managed code to process requests.

public ref class HttpWorkerRequest abstract
[System.Runtime.InteropServices.ComVisible(false)]
public abstract class HttpWorkerRequest
type HttpWorkerRequest = class
Public MustInherit Class HttpWorkerRequest
继承
HttpWorkerRequest
派生
属性

注解

在大多数情况下,代码不会HttpWorkerRequest直接处理,因为请求和响应数据HttpRequest通过和HttpResponse类公开。In most cases, your code will not deal with HttpWorkerRequest directly because request and response data are exposed through the HttpRequest and HttpResponse classes. 某些内部 ASP.NET 类扩展了此类。Some internal ASP.NET classes extend this class. 如果代码实现自己的宿主环境,则需要扩展此类以调用ProcessRequest方法。If your code implements its own hosting environment, it will need to extend this class to call the ProcessRequest method. 此外,你的代码可以创建一个派生类,以便在给定应用程序中执行子请求,以便将其实例传递到ProcessRequestIn addition, your code could create a derived class for the purpose of child-request execution within a given application in order to pass its instance to ProcessRequest. 在这种情况下,派生类应保留对当前HttpWorkerRequest的引用并将大多数方法委托给它。In this case, the derived class should keep a reference to the current HttpWorkerRequest and delegate most of the methods to it.

构造函数

HttpWorkerRequest()

初始化 HttpWorkerRequest 类的新实例。Initializes a new instance of the HttpWorkerRequest class.

字段

HeaderAccept

指定 AcceptHTTP 标头的索引号。Specifies the index number for the Accept HTTP header.

HeaderAcceptCharset

指定 Accept-CharsetHTTP 标头的索引号。Specifies the index number for the Accept-Charset HTTP header.

HeaderAcceptEncoding

指定 Accept-EncodingHTTP 标头的索引号。Specifies the index number for the Accept-Encoding HTTP header.

HeaderAcceptLanguage

指定 Accept-LanguageHTTP 标头的索引号。Specifies the index number for the Accept-Language HTTP header.

HeaderAcceptRanges

指定 Accept-RangesHTTP 标头的索引号。Specifies the index number for the Accept-Ranges HTTP header.

HeaderAge

指定 AgeHTTP 标头的索引号。Specifies the index number for the Age HTTP header.

HeaderAllow

指定 AllowHTTP 标头的索引号。Specifies the index number for the Allow HTTP header.

HeaderAuthorization

指定 AuthorizationHTTP 标头的索引号。Specifies the index number for the Authorization HTTP header.

HeaderCacheControl

表示 HTTPCache-ControlHTTP 标头的索引。The index that represents the HTTP Cache-Control HTTP header.

HeaderConnection

指定 ConnectionHTTP 标头的索引号。Specifies the index number for the Connection HTTP header.

HeaderContentEncoding

指定 Content-EncodingHTTP 标头的索引号。Specifies the index number for the Content-Encoding HTTP header.

HeaderContentLanguage

指定 Content-LanguageHTTP 标头的索引号。Specifies the index number for the Content-Language HTTP header.

HeaderContentLength

指定 Content-LengthHTTP 标头的索引号。Specifies the index number for the Content-Length HTTP header.

HeaderContentLocation

指定 Content-LocationHTTP 标头的索引号。Specifies the index number for the Content-Location HTTP header.

HeaderContentMd5

指定 Content-MD5HTTP 标头的索引号。Specifies the index number for the Content-MD5 HTTP header.

HeaderContentRange

指定 Content-RangeHTTP 标头的索引号。Specifies the index number for the Content-Range HTTP header.

HeaderContentType

指定 Content-TypeHTTP 标头的索引号。Specifies the index number for the Content-Type HTTP header.

HeaderCookie

指定 CookieHTTP 标头的索引号。Specifies the index number for the Cookie HTTP header.

HeaderDate

指定 DateHTTP 标头的索引号。Specifies the index number for the Date HTTP header.

HeaderEtag

指定 ETagHTTP 标头的索引号。Specifies the index number for the ETag HTTP header.

HeaderExpect

指定 ExceptHTTP 标头的索引号。Specifies the index number for the Except HTTP header.

HeaderExpires

指定 ExpiresHTTP 标头的索引号。Specifies the index number for the Expires HTTP header.

HeaderFrom

指定 FromHTTP 标头的索引号。Specifies the index number for the From HTTP header.

HeaderHost

指定 HostHTTP 标头的索引号。Specifies the index number for the Host HTTP header.

HeaderIfMatch

指定 If-MatchHTTP 标头的索引号。Specifies the index number for the If-Match HTTP header.

HeaderIfModifiedSince

指定 If-Modified-SinceHTTP 标头的索引号。Specifies the index number for the If-Modified-Since HTTP header.

HeaderIfNoneMatch

指定 If-None-MatchHTTP 标头的索引号。Specifies the index number for the If-None-Match HTTP header.

HeaderIfRange

指定 If-RangeHTTP 标头的索引号。Specifies the index number for the If-Range HTTP header.

HeaderIfUnmodifiedSince

指定 If-Unmodified-SinceHTTP 标头的索引号。Specifies the index number for the If-Unmodified-Since HTTP header.

HeaderKeepAlive

指定 Keep-AliveHTTP 标头的索引号。Specifies the index number for the Keep-Alive HTTP header.

HeaderLastModified

指定 Last-ModifiedHTTP 标头的索引号。Specifies the index number for the Last-Modified HTTP header.

HeaderLocation

指定 LocationHTTP 标头的索引号。Specifies the index number for the Location HTTP header.

HeaderMaxForwards

指定 Max-ForwardsHTTP 标头的索引号。Specifies the index number for the Max-Forwards HTTP header.

HeaderPragma

指定 PragmaHTTP 标头的索引号。Specifies the index number for the Pragma HTTP header.

HeaderProxyAuthenticate

指定 Proxy-AuthenticateHTTP 标头的索引号。Specifies the index number for the Proxy-Authenticate HTTP header.

HeaderProxyAuthorization

指定 Proxy-AuthorizationHTTP 标头的索引号。Specifies the index number for the Proxy-Authorization HTTP header.

HeaderRange

指定 RangeHTTP 标头的索引号。Specifies the index number for the Range HTTP header.

HeaderReferer

指定 RefererHTTP 标头的索引号。Specifies the index number for the Referer HTTP header.

HeaderRetryAfter

指定 Retry-AfterHTTP 标头的索引号。Specifies the index number for the Retry-After HTTP header.

HeaderServer

指定 ServerHTTP 标头的索引号。Specifies the index number for the Server HTTP header.

HeaderSetCookie

指定 Set-CookieHTTP 标头的索引号。Specifies the index number for the Set-Cookie HTTP header.

HeaderTe

指定 TEHTTP 标头的索引号。Specifies the index number for the TE HTTP header.

HeaderTrailer

指定 TrailerHTTP 标头的索引号。Specifies the index number for the Trailer HTTP header.

HeaderTransferEncoding

指定 Transfer-EncodingHTTP 标头的索引号。Specifies the index number for the Transfer-Encoding HTTP header.

HeaderUpgrade

指定 UpgradeHTTP 标头的索引号。Specifies the index number for the Upgrade HTTP header.

HeaderUserAgent

指定 User-AgentHTTP 标头的索引号。Specifies the index number for the User-Agent HTTP header.

HeaderVary

指定 VaryHTTP 标头的索引号。Specifies the index number for the Vary HTTP header.

HeaderVia

指定 ViaHTTP 标头的索引号。Specifies the index number for the Via HTTP header.

HeaderWarning

指定 WarningHTTP 标头的索引号。Specifies the index number for the Warning HTTP header.

HeaderWwwAuthenticate

指定 WWW-AuthenticateHTTP 标头的索引号。Specifies the index number for the WWW-Authenticate HTTP header.

ReasonCachePolicy

指定请求的原因。Specifies a reason for the request.

ReasonCacheSecurity

指定请求的原因。Specifies a reason for the request.

ReasonClientDisconnect

指定请求的原因。Specifies a reason for the request.

ReasonDefault

指定请求的原因。Specifies a reason for the request. 默认值为 ReasonResponseCacheMissThe default value is ReasonResponseCacheMiss.

ReasonFileHandleCacheMiss

指定请求的原因。Specifies a reason for the request.

ReasonResponseCacheMiss

指定请求的原因。Specifies a reason for the request.

RequestHeaderMaximum

指定 MaximumHTTP 请求标头的索引号。Specifies the index number for the Maximum HTTP request header.

ResponseHeaderMaximum

指定 MaximumHTTP 响应标头的索引号。Specifies the index number for the Maximum HTTP response header.

属性

MachineConfigPath

获取 Machine.config 文件的完整物理路径。Gets the full physical path to the Machine.config file.

MachineInstallDirectory

获取 ASP.NET 二进制文件的安装目录的物理路径。Gets the physical path to the directory where the ASP.NET binaries are installed.

RequestTraceIdentifier

获取当前请求的 Windows 跟踪 ID 的对应事件跟踪。Gets the corresponding Event Tracking for Windows trace ID for the current request.

RootWebConfigPath

获取根 Web.config 文件的完整物理路径。Gets the full physical path to the root Web.config file.

SupportsAsyncFlush

获取一个值,该值指示是否支持异步刷新操作。Gets a value that indicates whether asynchronous flush operations are supported.

SupportsAsyncRead

获取一个值,该值指示是否支持异步读取操作。Gets a value that indicates whether asynchronous read operations are supported.

方法

BeginFlush(AsyncCallback, Object)

向客户端发送当前所有缓冲的响应。Sends the currently buffered response to the client.

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

启动请求的实体正文中的一次异步读取操作。Begins an asynchronous read operation of the request entity body.

CloseConnection()

终止与客户端的连接。Terminates the connection with the client.

EndFlush(IAsyncResult)

等待挂起的异步刷新操作完成。Waits for the pending asynchronous flush operation to complete.

EndOfRequest()

由运行时使用以通知 HttpWorkerRequest 当前请求的请求处理已完成。Used by the runtime to notify the HttpWorkerRequest that request processing for the current request is complete.

EndRead(IAsyncResult)

等待挂起的异步读操作完成。Waits for the pending asynchronous read operation to complete.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
FlushResponse(Boolean)

将所有挂起的响应数据发送到客户端。Sends all pending response data to the client.

GetAppPath()

返回当前正在执行的服务器应用程序的虚拟路径。Returns the virtual path to the currently executing server application.

GetAppPathTranslated()

返回当前正在执行的服务器应用程序的物理路径。Returns the physical path to the currently executing server application.

GetAppPoolID()

在派生类中被重写时,返回当前 URL 的应用程序池 ID。When overridden in a derived class, returns the application pool ID for the current URL.

GetBytesRead()

获取从客户端读入的字节数。Gets the number of bytes read in from the client.

GetClientCertificate()

在派生类中被重写时,从客户端发出的请求获取证书字段(以 X.509 标准指定)。When overridden in a derived class, gets the certification fields (specified in the X.509 standard) from a request issued by the client.

GetClientCertificateBinaryIssuer()

获取证书颁发者(以二进制格式表示)。Gets the certificate issuer, in binary format.

GetClientCertificateEncoding()

在派生类中被重写时,返回用于编码客户端证书的 Encoding 对象。When overridden in a derived class, returns the Encoding object in which the client certificate was encoded.

GetClientCertificatePublicKey()

在派生类中被重写时,获取与客户端证书关联的 PublicKey 对象。When overridden in a derived class, gets a PublicKey object associated with the client certificate.

GetClientCertificateValidFrom()

在派生类中被重写时,则获取证书开始生效的日期。When overridden in a derived class, gets the date when the certificate becomes valid. 此日期随区域设置的不同而不同。The date varies with international settings.

GetClientCertificateValidUntil()

获取证书到期日期。Gets the certificate expiration date.

GetConnectionID()

在派生类中被重写时,返回当前连接的 ID。When overridden in a derived class, returns the ID of the current connection.

GetFilePath()

在派生类中被重写时,返回所请求的 URI 的虚拟路径。When overridden in a derived class, returns the virtual path to the requested URI.

GetFilePathTranslated()

返回请求的 URI 的物理文件路径(并将其从虚拟路径转换成物理路径:例如,从“/proj1/page.aspx”转换成“c:\dir\page.aspx”)Returns 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")

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetHttpVerbName()

返回请求标头的指定成员。Returns the specified member of the request header.

GetHttpVersion()

提供对请求的 HTTP 版本(如“HTTP/1.1”)的访问。Provides access to the HTTP version of the request (for example, "HTTP/1.1").

GetKnownRequestHeader(Int32)

返回与指定的索引相对应的标准 HTTP 请求标头。Returns the standard HTTP request header that corresponds to the specified index.

GetKnownRequestHeaderIndex(String)

返回指定的 HTTP 请求标头的索引号。Returns the index number of the specified HTTP request header.

GetKnownRequestHeaderName(Int32)

返回指定的 HTTP 请求标头的名称。Returns the name of the specified HTTP request header.

GetKnownResponseHeaderIndex(String)

返回指定的 HTTP 响应标头的索引号。Returns the index number of the specified HTTP response header.

GetKnownResponseHeaderName(Int32)

返回指定的 HTTP 响应标头的名称。Returns the name of the specified HTTP response header.

GetLocalAddress()

提供对请求标头的指定成员的访问。Provides access to the specified member of the request header.

GetLocalPort()

提供对请求标头的指定成员的访问。Provides access to the specified member of the request header.

GetPathInfo()

返回具有 URL 扩展的资源的其他路径信息。Returns additional path information for a resource with a URL extension. 即对于路径 /virdir/page.html/tail,GetPathInfo 值为 /tail。That is, for the path /virdir/page.html/tail, the GetPathInfo value is /tail.

GetPreloadedEntityBody()

返回 HTTP 请求正文已被读取的部分。Returns the portion of the HTTP request body that has already been read.

GetPreloadedEntityBody(Byte[], Int32)

使用指定的缓冲区数据和字节偏移量获取 HTTP 请求正文当前已被读取的部分。Gets the portion of the HTTP request body that has currently been read by using the specified buffer data and byte offset.

GetPreloadedEntityBodyLength()

获取 HTTP 请求正文当前已被读取部分的长度。Gets the length of the portion of the HTTP request body that has currently been read.

GetProtocol()

在派生类中被重写时,返回 HTTP 协议(HTTP 或 HTTPS)。When overridden in a derived class, returns the HTTP protocol (HTTP or HTTPS).

GetQueryString()

返回请求 URL 中指定的查询字符串。Returns the query string specified in the request URL.

GetQueryStringRawBytes()

在派生类中被重写时,以字节数组的形式返回响应查询字符串。When overridden in a derived class, returns the response query string as an array of bytes.

GetRawUrl()

返回附加了查询字符串的请求标头中包含的 URL 路径。Returns the URL path contained in the request header with the query string appended.

GetRemoteAddress()

提供对请求标头的指定成员的访问。Provides access to the specified member of the request header.

GetRemoteName()

在派生类中被重写时,返回客户端计算机的名称。When overridden in a derived class, returns the name of the client computer.

GetRemotePort()

提供对请求标头的指定成员的访问。Provides access to the specified member of the request header.

GetRequestReason()

在派生类中被重写时,返回请求的原因。When overridden in a derived class, returns the reason for the request.

GetServerName()

在派生类中被重写时,返回本地服务器的名称。When overridden in a derived class, returns the name of the local server.

GetServerVariable(String)

从与请求关联的服务器变量词典返回单个服务器变量。Returns a single server variable from a dictionary of server variables associated with the request.

GetStatusDescription(Int32)

返回一个字符串,该字符串描述指定的 HTTP 状态代码的名称。Returns a string that describes the name of the specified HTTP status code.

GetTotalEntityBodyLength()

获取整个 HTTP 请求正文的长度。Gets the length of the entire HTTP request body.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetUnknownRequestHeader(String)

返回非标准的 HTTP 请求标头值。Returns a nonstandard HTTP request header value.

GetUnknownRequestHeaders()

获取所有非标准的 HTTP 标头的名称/值对。Get all nonstandard HTTP header name-value pairs.

GetUriPath()

返回请求的 URI 的虚拟路径。Returns the virtual path to the requested URI.

GetUrlContextID()

当在派生类中被重写时,返回当前连接的上下文 ID。When overridden in a derived class, returns the context ID of the current connection.

GetUserToken()

在派生类中被重写时,返回客户端的模拟标记。When overridden in a derived class, returns the client's impersonation token.

GetVirtualPathToken()

获取请求虚拟路径的模拟标记。Gets the impersonation token for the request virtual path.

HasEntityBody()

返回一个值,该值指示请求是否包含正文数据。Returns a value indicating whether the request contains body data.

HeadersSent()

返回一个值,该值指示是否已为当前的请求将 HTTP 响应标头发送到客户端。Returns a value indicating whether HTTP response headers have been sent to the client for the current request.

IsClientConnected()

返回一个值,该值指示客户端连接是否仍处于活动状态。Returns a value indicating whether the client connection is still active.

IsEntireEntityBodyIsPreloaded()

返回一个值,该值指示是否所有请求数据都可用,以及是否不需要对客户端进行进一步读取。Returns a value indicating whether all request data is available and no further reads from the client are required.

IsSecure()

返回一个指示连接是否使用 SSL 的值。Returns a value indicating whether the connection uses SSL.

MapPath(String)

返回与指定虚拟路径相对应的物理路径。Returns the physical path corresponding to the specified virtual path.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ReadEntityBody(Byte[], Int32)

读取客户端的请求数据(在尚未预加载时)。Reads request data from the client (when not preloaded).

ReadEntityBody(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.

SendCalculatedContentLength(Int32)

Content-Length HTTP 标头添加到小于或等于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are less than or equal to 2 GB.

SendCalculatedContentLength(Int64)

Content-Length HTTP 标头添加到大于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are greater than 2 GB.

SendKnownResponseHeader(Int32, String)

将标准 HTTP 标头添加到响应。Adds a standard HTTP header to the response.

SendResponseFromFile(IntPtr, Int64, Int64)

将指定文件的内容添加到响应并指定文件中的起始位置和要发送的字节数。Adds the contents of the specified file to the response and specifies the starting position in the file and the number of bytes to send.

SendResponseFromFile(String, Int64, Int64)

将指定文件的内容添加到响应并指定文件中的起始位置和要发送的字节数。Adds the contents of the specified file to the response and specifies the starting position in the file and the number of bytes to send.

SendResponseFromMemory(Byte[], Int32)

将字节数组中指定数目的字节添加到响应。Adds the specified number of bytes from a byte array to the response.

SendResponseFromMemory(IntPtr, Int32)

将内存块中指定数目的字节添加到响应。Adds the specified number of bytes from a block of memory to the response.

SendStatus(Int32, String)

指定响应的 HTTP 状态代码和状态说明,例如 SendStatus(200,"Ok")Specifies the HTTP status code and status description of the response, such as SendStatus(200, "Ok").

SendUnknownResponseHeader(String, String)

将非标准 HTTP 标头添加到响应。Adds a nonstandard HTTP header to the response.

SetEndOfSendNotification(HttpWorkerRequest+EndOfSendNotification, Object)

在发送所有响应数据后注册可选通知。Registers for an optional notification when all the response data is sent.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅