Share via


WebAccountProviderRetrieveCookiesOperation Class

Definition

Represents a retrieve cookies operation made by a web account provider.

public ref class WebAccountProviderRetrieveCookiesOperation sealed : IWebAccountProviderBaseReportOperation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class WebAccountProviderRetrieveCookiesOperation final : IWebAccountProviderBaseReportOperation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class WebAccountProviderRetrieveCookiesOperation : IWebAccountProviderBaseReportOperation
Public NotInheritable Class WebAccountProviderRetrieveCookiesOperation
Implements IWebAccountProviderBaseReportOperation
Inheritance
Object Platform::Object IInspectable WebAccountProviderRetrieveCookiesOperation
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following demonstrates how to handle a retrieve cookies operation:

void HandleRetrieveCookies(WebAccountProviderRetrieveCookiesOperation operation)
{
    try
    {
        // Parse the Uri to retrieve context information
        Uri myUri = ParseMyUri(operation.Context);

        // Do custom logic based on the context
        // INSERT LOGIC HERE

        // Get the HttpCookieCollection for the Uri
        HttpBaseProtocolFilter filt = new HttpBaseProtocolFilter();
        HttpCookieCollection cookies = filt.CookieManager.GetCookies(myUri);
        foreach (HttpCookie cookie in cookies)
        {
            operation.Cookies.Add(cookie);
        }
        operation.ReportCompleted();
    }
    catch (Exception ex)
    {
        WebProviderError error = new WebProviderError(ERROR_CODE_FOO, ex.Message);
        operation.ReportError(error); 
    }
}

Properties

ApplicationCallbackUri

Gets the app callback Uri.

Context

Gets the context of the retrieve cookies operation.

Cookies

Gets the cookies.

Kind

Gets the kind of web account provider operation.

Uri

Gets or sets the Uri to retrieve cookies from.

Methods

ReportCompleted()

Informs the activating app that the operation completed successfully.

ReportError(WebProviderError)

Informs the activating app that the operation encountered an error.

Applies to

See also