Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Custom Membership Providers in WCF & Silverlight

Back to Forum: Tech Off
  • User profile image
    Galo

    Hi gang,

    I have a question and no one seems to have an awnser, so ofcourse the last thing one tries is the 9th channel Tongue Out
    Let's cut to it...

    I made a Silverlight application that uwses a service, the service is a WCF service, and as you might know we have a default Membership provider comming with WCF, which are

    System.Web.ApplicationServices.AuthenticationService
    System.Web.ApplicationServices.ProfileService
    System.Web.ApplicationServices.RoleService

    So, knowing this, we have a new challenge of creating a user login based on Silverlight & WCF

    AuthenticationServiceClient client = new AuthenticationServiceClient();
    client.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(LoginCompleted);
    client.LoginAsync(tbxUsername.Text, Password.Value, "", true, tbxUsername.Text);

    Jippee,.. all good IF we only had a locale database running in the App_Data folder, and since im an employee of enterprise X and we have our databases running on a different server which does use the default asp_net authentication im pretty f****d no, hmmm we could create our own custom membership providers configured in the web.config of my service layer, yeehaaa,... let's do that...

    <roleManager enabled="true" defaultProvider="Role">
    <providers>
    <add name="Role" type="X.Model.Provider.Role" connectionStringName="SqlXConnectionString" applicationName="/X.GUI"/>
    </providers>
    </roleManager>
    <membership defaultProvider="Membership" userIsOnlineTimeWindow="10">
    <providers>
    <add name="Membership" type="X.Model.Provider.Membership" connectionStringName="SqlXConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordStrengthRegularExpression="" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" applicationName="/X.GUI"/>
    </providers>
    </membership>
    <profile defaultProvider="Profile" enabled="true"><providers>
    <add name="Profile" type="X.Model.Provider.Profile" connectionStringName="SqlXConnectionString" applicationName="/X.GUI"/>
    </providers>
    <properties>
    <add name="Color" type="string" defaultValue="Red" />
    <add name="Naam" type="String" serializeAs="String"/>
    <add name="Omschrijving" type="String" serializeAs="String"/>
    <add name="Intern" type="Boolean" serializeAs="String"/>
    <add name="Actief" type="Boolean" serializeAs="String"/>
    <add name="MedewerkerNummer" type="String" serializeAs="String"/>
    <add name="FunctieNiveau" type="Int32" serializeAs="String"/>
    <add name="Direct" type="Boolean" serializeAs="String"/>
    <add name="FTE" type="String" serializeAs="String"/>
    <add name="PercDirect" type="String" serializeAs="String"/>
    <add name="PercIndirect" type="String" serializeAs="String"/>
    </properties>
    </profile>

    So, i try the WSAT throught the ASP.Net Configuration, and yes, i have all my data correctly in front of me, my users, roles and application settings, and one would think he is done... but he aint, cause it aint working, not at all.... i tryt to log in with the right credentials, but the e.Result keeps returning false in the OnCompleted method.

    How come, does anyone know what im looking over or what i've done wrong, your help would be apreciated

    thanks in advance!
     

  • User profile image
    Maddus Mattus

    Try running a Sql Profiler against the server to see if any of the queries get fired against the database.

  • User profile image
    Galo

    Maddus Mattus said:
    Try running a Sql Profiler against the server to see if any of the queries get fired against the database.

    Ahahaha, aint we all stupid once in a while, lol, seems i had to trim the characters in the password string i got back, so my login failed and after 5 times it locked the account.... i can cry about now Sad

    It all works now, thanks anyway niners!

  • User profile image
    Maddus Mattus

    Galo said:
    Maddus Mattus said:
    *snip*

    Ahahaha, aint we all stupid once in a while, lol, seems i had to trim the characters in the password string i got back, so my login failed and after 5 times it locked the account.... i can cry about now Sad

    It all works now, thanks anyway niners!

    Veel succses met je applicatie!

    Good luck with the application!

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.