class Program { static void Main(string[] args) { AuthenticationServiceClient asc = new AuthenticationServiceClient(); string cookies = ""; using (OperationContextScope scope = new OperationContextScope(asc.InnerChannel)) { asc.Login(username, password, null, false); cookies = OperationContext.Current.GetOutgoingCookies(); } PrimeServiceClient psc = new PrimeServiceClient(); using (OperationContextScope scope = new OperationContextScope(psc.InnerChannel)) { OperationContext.Current.SetOutgoingCookies(cookies); Console.WriteLine(psc.NextPrime(3)); } using (OperationContextScope scope = new OperationContextScope(asc.InnerChannel)) { OperationContext.Current.SetOutgoingCookies(cookies); asc.Logout(); } } }