Click here to Skip to main content
15,944,390 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I configured a lightswitch application with an aspnet membership database. I use it to add users and roles. Now, I want my WPF to use Client Application Services with Windows Authentication set up to an specific applicationName (Same used in LightSwitch)

After configuring my project in the project properties (Services) to use Client Application Service, I added to the app.config Membership Provider the applicationName.

Then in my code, I tried the following:
if (Membership.ValidateUser(null, null))
    if (Thread.CurrentPrincipal.IsInRole("TestRole"))
        MessageBox.Show("User is in TestRole Role");

When the IsInRole method is executed, I get the following exception: Invalid object name 'UserProperties'

Any idea or sample in how to verify user roles using windows authentication in WPF and aspnet membership database?


1 solution

Problem solved for my scenario.

I ended up using the code exactly as I mentioned originally. But in order to make it work, I needed to create a group of tables as mentioned in

Then instead of using the aspnet membership database, I use this set of tables to store User/Role information.

Adding those tables removed the error exception of "Invalid object name 'UserProperties'", since 'UserProperties' is the name of one of the tables created.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900