Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Sets a cookie associated with the specified URL in the HTTP cookie jar.
Syntax
HRESULT SetCookie(
const XHR_COOKIE *pCookie,
DWORD *pdwCookieState
);
Parameters
pCookie
A pointer to an XHR_COOKIE structure that specifies the cookie and properties of the cookie to be associated with the specified URL.
pdwCookieState
A pointer to a value that indicates the cookie state if the call completes successfully.
This parameter can be one of the values from the XHR_COOKIE_STATE enumeration type defined in the Msxml6.h header file.
Return value
Returns S_OK on success.
Remarks
The SetCookie method has different behavior for Windows Store apps and Windows desktop applications.
When used in a Windows Store app, the SetCookie method by default sets the cookie as a persistent cookie in the Windows Store app. When the dwFlags member of the XHR_COOKIE has the XHR_COOKIE_IS_SESSION flag set, then the cookie is set only for the current session of the app.
When used in a Windows desktop application, the SetCookie method by default sets a persistent cookie that is system wide and shared by all Windows desktop applications. When the dwFlags member of the XHR_COOKIE has the XHR_COOKIE_IS_SESSION flag set, then the cookie is set only for the current session of the Windows desktop application.
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 8 [desktop apps | UWP apps],MSXML 6.0 and later |
| Minimum supported server | Windows Server 2012 [desktop apps | UWP apps] |
| Target Platform | Windows |
| Header | msxml6.h |