代码之家  ›  专栏  ›  技术社区  ›  Jonas Follesø

WCF、ASP.NET成员资格提供程序和身份验证服务

  •  13
  • Jonas Follesø  · 技术社区  · 18 年前

    Authentication service

    • MyDataService.svc<-处理我的数据的那个
    • AuthenticationService.svc<-windows应用程序必须调用才能进行身份验证。

    6 回复  |  直到 18 年前
        1
  •  5
  •   Jonas Follesø    18 年前

    WCF Authentication Service

    var authService = new AuthService.AuthenticationServiceClient();
    var diveService = new DiveLogService.DiveLogServiceClient();
    
    string cookieHeader = "";
    using (OperationContextScope scope = new OperationContextScope(authService.InnerChannel))
    {
        HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty();
        OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty;
        bool isGood = authService.Login("jonas", "jonas", string.Empty, true);
        MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
        HttpResponseMessageProperty responseProperty = (HttpResponseMessageProperty)properties[HttpResponseMessageProperty.Name];
        cookieHeader = responseProperty.Headers[HttpResponseHeader.SetCookie];                
    }
    
    using (OperationContextScope scope = new OperationContextScope(diveService.InnerChannel))
    {
        HttpRequestMessageProperty httpRequest = new HttpRequestMessageProperty();
        OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);
        httpRequest.Headers.Add(HttpRequestHeader.Cookie, cookieHeader);
        var res = diveService.GetDives();
    }      
    

        2
  •  2
  •   Jeremy McGee    18 年前

    here .

    有一件事

        3
  •  1
  •   Tony Brummel Tony Brummel    17 年前

        4
  •  0
  •   larsw    18 年前

    我稍后会尝试模仿一些东西并将其发送给您。

        6
  •  0
  •   John Bailey John Bailey    17 年前
    推荐文章