Pixytech

Lead Architect  •  Full Stack Engineer

Category: WCF

  • Configuring RIA to use roleManager, membership and profile.

    Create Silverlight Project “Business Navingation application” in Visual Studio 2010 Beta 2 and configure SQL express database to generate schema for rolemanager, membership and profile feature using command

    Launch Visual Studio Command prompt (Run as administrator)
    Type command
    Aspnet_regsql.exe –E–S sqlinstance–A rmp
    This will create sql express database aspnetdb

    Visit links to see how to configure components mentioned above

    Configure Role Manager
    Configure Membership Manager
    Configure profile Manager

    Edit web.config file as
    <configuration>
    <!– Connection to database (also used by rolemanager,membership manager and profile manager) –>
    <connectionStrings>
    <add name=”SQLDataSource” connectionString=”Data Source= .SQLExpress;Initial Catalog=aspnetdb;Integrated Security=SSPI;” />
    </connectionStrings>
    ……
    <!– Configure Role Manager (See : http://msdn.microsoft.com/en-us/library/ms998314.aspx)–>
    <roleManager enabled=”true” defaultProvider=”SqlDataRoleProvider”>
    <providers> <clear />
    <add name=”SqlDataRoleProvider”
    type=”System.Web.Security.SqlRoleProvider”
    connectionStringName=”SQLDataSource”
    applicationName=” APPName ” />
    </providers>
    </roleManager>
    <!– Configure Membership Manager (See : http://msdn.microsoft.com/en-us/library/ms998347.aspx)–>
    <membership defaultProvider=”SqlDataMemberProvider” userIsOnlineTimeWindow=”1″>
    <providers> <clear />
    <add name=”SqlDataMemberProvider”
    type=”System.Web.Security.SqlMembershipProvider”
    connectionStringName=”SQLDataSource”
    applicationName=” APPName “
    enablePasswordRetrieval=”false”
    enablePasswordReset=”true”
    requiresQuestionAndAnswer=”true”
    requiresUniqueEmail=”true”
    passwordFormat=”Hashed” />
    </providers>
    </membership>

    <!– Configure profile Manager (See : http://msdn.microsoft.com/en-us/library/014bec1k.aspx)–>
    <profile defaultProvider=”SqlDataProfileProvider”>
    <properties>
    <add name=”FriendlyName”/>
    </properties>
    <providers> <clear />
    <add name=”SqlDataProfileProvider” type=”System.Web.Profile.SqlProfileProvider”
    connectionStringName=”SQLDataSource” applicationName=”APPName” />
    </providers>
    </profile>
    ……
    </system.web>
    …..

    For more details please follow links mentioned in post