This documentation is archived and is not being maintained.

HttpCookie.Domain Property

Gets or sets the domain to associate the cookie with.

[Visual Basic]
Public Property Domain As String
public string Domain {get; set;}
public: __property String* get_Domain();
public: __property void set_Domain(String*);
public function get Domain() : String;
public function set Domain(String);

Property Value

The name of the domain to associate the cookie with. The default value is the current domain.


Setting the Domain attribute limits transmission of the cookie to clients requesting a resource from that domain.


The following example sets the cookie's domain.

[Visual Basic] 
MyCookie.Domain = ""

MyCookie.Domain = "";

MyCookie->Domain = S"";

myCookie.Domain = ""


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpCookie Class | HttpCookie Members | System.Web Namespace