WebAccountProviderRetrieveCookiesOperation 类

定义

表示 Web 帐户提供程序执行的检索 Cookie 操作。

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
继承
Object Platform::Object IInspectable WebAccountProviderRetrieveCookiesOperation
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

下面演示了如何处理检索 Cookie 操作:

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); 
    }
}

属性

ApplicationCallbackUri

获取应用回调 URI。

Context

获取检索 Cookie 操作的上下文。

Cookies

获取 Cookie。

Kind

获取 Web 帐户提供程序操作的类型。

Uri

获取或设置要从中检索 Cookie 的 Uri。

方法

ReportCompleted()

通知正在激活的应用操作已成功完成。

ReportError(WebProviderError)

通知正在激活的应用操作遇到错误。

适用于

另请参阅