예제 #1
0
파일: Program.cs 프로젝트: yasirbhutta/docs
    void GetProfileInfo(CookieContainer cookieContainer)
    {
        string endPtAddr = strEndPtAddr("MyProfileSvcWrap");

        ProfileServiceClient profileSvc = new ProfileServiceClient(new BasicHttpBinding(),
                                                                   new EndpointAddress(endPtAddr));

        string[] strProfileProps = new string[] { "FirstName", "LastName", "PhoneNumber" };

        using (new OperationContextScope(profileSvc.InnerChannel)) {
            SetCookies(OperationContext.Current, cookieContainer);
            Dictionary <string, object> profileData =
                profileSvc.GetPropertiesForCurrentUser(strProfileProps, true);

            foreach (string sProp in strProfileProps)
            {
                Console.WriteLine(sProp + ": " + profileData[sProp]);
            }
        }
    }