Export (0) Print
Expand All

HttpCookie.Domain Property

Gets or sets the domain to associate the cookie with.

[Visual Basic]
Public Property Domain As String
[C#]
public string Domain {get; set;}
[C++]
public: __property String* get_Domain();
public: __property void set_Domain(String*);
[JScript]
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.

Remarks

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

Example

The following example sets the cookie's domain.

[Visual Basic] 
MyCookie.Domain = "Microsoft.com"
    

[C#] 
MyCookie.Domain = "Microsoft.com";
    

[C++] 
MyCookie->Domain = S"Microsoft.com";
    

[JScript] 
myCookie.Domain = "Microsoft.com"
    

Requirements

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

See Also

HttpCookie Class | HttpCookie Members | System.Web Namespace

Show:
© 2014 Microsoft