FileWebResponse 类

定义

提供 WebResponse 类的文件系统实现。Provides a file system implementation of the WebResponse class.

public ref class FileWebResponse : System::Net::WebResponse, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class FileWebResponse : System.Net.WebResponse, System.Runtime.Serialization.ISerializable
type FileWebResponse = class
    inherit WebResponse
    interface ISerializable
Public Class FileWebResponse
Inherits WebResponse
Implements ISerializable
继承
属性
实现

注解

FileWebResponse 类实现了 WebResponseabstract 基类,以返回 FileWebRequest 类的文件系统资源。The FileWebResponse class implements the WebResponseabstract base class to return file system resources for the FileWebRequest class.

客户端应用程序不会直接创建 FileWebResponse 实例;相反,它们是通过对 FileWebRequest 实例调用 GetResponse 方法来创建的。Client applications do not create FileWebResponse instances directly; instead, they are created by calling the GetResponse method on a FileWebRequest instance.

GetResponseStream 方法返回一个 Stream 实例,该实例提供对文件系统资源的只读访问。The GetResponseStream method returns a Stream instance that provides read-only access to a file system resource.

FileWebResponse 类依赖于 File 类来实现错误处理和代码访问安全性。The FileWebResponse class relies on the File class for error handling and code access security.

构造函数

FileWebResponse(SerializationInfo, StreamingContext)

FileWebResponseSerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。Initializes a new instance of the FileWebResponse class from the specified instances of the SerializationInfo and StreamingContext classes.

属性

ContentLength

获取文件系统资源中的内容长度。Gets the length of the content in the file system resource.

ContentType

获取文件系统资源的内容类型。Gets the content type of the file system resource.

Headers

获取与响应关联的标头名称/值对集合。Gets a collection of header name/value pairs associated with the response.

IsFromCache

获取一个 Boolean 值,该值指示此响应是否为从缓存中获取的。Gets a Boolean value that indicates whether this response was obtained from the cache.

(继承自 WebResponse)
IsMutuallyAuthenticated

获取一个 Boolean 值,该值指示是否发生了相互身份验证。Gets a Boolean value that indicates whether mutual authentication occurred.

(继承自 WebResponse)
ResponseUri

获取提供响应的文件系统资源的 URI。Gets the URI of the file system resource that provided the response.

SupportsHeaders

获取一个值,该值指示 Headers 属性是否由 FileWebResponse 实例支持。Gets a value that indicates whether the Headers property is supported by the FileWebResponse instance.

方法

Close()

关闭响应流。Closes the response stream.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放 WebResponse 对象使用的非托管资源。Releases the unmanaged resources used by the WebResponse object.

(继承自 WebResponse)
Dispose(Boolean)

释放 FileWebResponse 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the FileWebResponse and optionally releases the managed resources.

Equals(Object)

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

(继承自 Object)
GetHashCode()

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

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetObjectData(SerializationInfo, StreamingContext)

使用将目标对象序列化所需的数据填充 SerializationInfoPopulates a SerializationInfo with the data needed to serialize the target object.

GetResponseStream()

返回来自文件系统资源的数据流。Returns the data stream from the file system resource.

GetType()

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

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

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

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
ToString()

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

(继承自 Object)

显式接口实现

IDisposable.Dispose()

释放 FileWebResponse 使用的所有资源。Releases all resources used by the FileWebResponse.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

用序列化 SerializationInfo 所需的数据填充 FileWebResponse 实例。Populates a SerializationInfo instance with the data needed to serialize the FileWebResponse.

适用于