Silverlight RIA Services Active Directory Directory
This blog post has an answer. Silverlight with WCF Ria Service Services and Active Directory Roles . Thanks Dan for this post!
I'm using Silverlight 4, so a few things have changed since this post. I also used the business application template for this project.
Step 1. This has already been set in the BussinessApplication template in the App.xaml.cs code. You need to comment out the line with webContext.Authentication = new FormsAuthentication();
and uncomment the line webContext.Authentication = new WindowsAuthentication();
.
Step 2. No changes. Add <authentication mode="Windows"/>
to web.config under the /configuration/system.web element.
Step 3. RiaContex is now a WebContext, so change that in the example. The first line to load the user was RiaContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
already in the code.
Step 4. No changes. add <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>
to web.config under the /configuration/system.web element.
With these small changes, the Silverlight application connected to Active Directory and populated WebContext.Current.User.Roles
which I was looking for.
a source to share