Application.GetCookie Method

Retrieves a cookie for the location specified by a Uri.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)

public static string GetCookie (
	Uri uri
public static String GetCookie (
	Uri uri
public static function GetCookie (
	uri : Uri
) : String
You cannot use methods in XAML.



The Uri that specifies the location for which a cookie was created.

Return Value

A String value, if the cookie exists; otherwise, a Win32Exception is raised.

Exception typeCondition


Application is hosted inside an HTMLIFrame.


A Win32 error is raised by InternetGetCookie (called by GetCookie) if a problem occurs when attempting to retrieve the specified cookie.

See SetCookie for information about cookies and how to create them.

GetCookie retrieves a cookie for the specified Uri. If the cookie can't be retrieved, a Win32Exception is raised.

See Application Cookies Sample for an example of creating and retrieving cookies.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0