Application.SetCookie Method (Uri, String)
Creates a cookie for the location specified by a Uri.
Assembly: PresentationFramework (in PresentationFramework.dll)
A Win32 error is raised by the InternetSetCookie function (called by) if a problem occurs when attempting to create the specified cookie.
A cookie is an arbitrary piece of data that can be stored by an application on the client machine during application sessions (session cookies) or across application sessions (persistent cookies). You can create both types of cookies by calling.
Cookie data typically takes the form of a name/value pair in the following format:
You pass a string of this format to Uri of the location for which the cookie should be set (typically, the application domain)., along with the
Whether a cookie is a session cookie or a persistent cookie depends on whether the cookie string that you pass toincludes an expiry date. The string for a session cookie does not include an expiry date. The string for a persistent cookie does, and must be in the following format:
NAME=VALUE; expires=DAY, DD-MMM-YYYY HH:MM:SS GMT
Persistent cookies are stored in the current Windows installation's Temporary Internet Files folder until they expire, in which case they are deleted. You can delete a persistent cookie from your application by setting its expiry date to a date/time value that is in the past.
For an overview of cookies in WPF, see Navigation Overview.
Available since 3.0