HttpCookieCollection 构造函数

定义

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

public:
 HttpCookieCollection();
public HttpCookieCollection ();
Public Sub New ()

示例

下面的示例创建一个新的 cookie 集合对象,并使用从客户端收到的 cookie 来填充它。The following example creates a new cookie collection object and fills it with the cookies received from the client.

HttpCookieCollection MyCookieCollection = new HttpCookieCollection();
 MyCookieCollection = Request.Cookies;

Dim MyCookieCollection As New HttpCookieCollection()
 MyCookieCollection = Request.Cookies
    

注解

ASP.NET 包括两个内部 cookie 集合。ASP.NET includes two intrinsic cookie collections. 可通过的集合 Cookies 包含客户端在标头中传输到服务器的 cookie CookieThe collection accessible through Cookies contains cookies transmitted by the client to the server in the Cookie header. 可通过的集合 Cookies 包含在服务器上生成并在标头中传输到客户端的 cookie Set-CookieThe collection accessible through Cookies contains cookies generated on the server and transmitted to the client in the Set-Cookie header.

适用于

另请参阅