The page has been moved to GitHub


Package: MyToolkit.Extended
Platforms: WPF

This extension methods can be used to authenticate an ASP.NET authenticated WCF service. You need to create an AuthenticationService which has to be called first to authenticate and read the session cookie:

String cookies = null; 
var auth = new AuthenticationServiceClient();
using (new OperationContextScope(auth.InnerChannel))
    auth.Login("user", "password", null, true);
    cookies = auth.GetIncomingCookies();

Then inject the cookie into your service or your HTTP call:

In a WCF service client:

var svc = new DataServiceClient();
using (new OperationContextScope(svc.InnerChannel))

In a DataServiceContext:

var client = new DataServiceClient();
client.SendingRequest += ClientBaseExtensions.SendingRequest(cookies);
var person = client.Persons.Single(p => p.Firstname == "Test");


Last edited Jun 3, 2015 at 10:58 PM by rsuter, version 20