Understanding defaultProvider for Membership and RoleManager?

I find different 'defaultProvider' used and don't know which one to use.

It seems that 'AspNetSqlProvider' is the standard, but I find others used.

Also, 'name=' and 'applicationName' are diffent from app to app, don't understand why?

Does the aspnet_Applications ApplicationName column need to match?

Here's my web.config

<system.web>       
               <authentication mode="Forms">
                          <forms name=".ASPXAUTH"
                                     loginUrl="login.aspx"
                                     defaultUrl="default.aspx"
                                     protection="All"
                                     timeout="30"
                                     path="/"
                           requireSSL="false"
                    slidingExpiration="true"                   
                    cookieless="UseCookies"
                    enableCrossAppRedirects="false"/>
            </authentication>       
                    <membership defaultProvider="AspNetSqlProvider" userIsOnlineTimeWindow="15">
            <providers>
                <add
                    name="AspNetSqlProvider"
                    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                    connectionStringName="AspSqlConn"
                    enablePasswordRetrieval="true"
                    enablePasswordReset="true"
                    requiresQuestionAndAnswer="false"
                    applicationName="AspNetSqlProvider"
                    requiresUniqueEmail="true"
                    passwordFormat="Clear"/>
            </providers>
        </membership>
       
        <roleManager
                    enabled="true"
                    cacheRolesInCookie="true"
                    defaultProvider="AspNetSqlRoleProvider"
                    cookieName=".ASPXROLES"
                    cookiePath="/"
                    cookieTimeout="30"
                    cookieRequireSSL="false"
                    cookieSlidingExpiration="true"
                    createPersistentCookie="false"
                    cookieProtection="All">            
        </roleManager>
</system.web>


Help
LVL 1
kvnsdrAsked:
Who is Participating?
 
Ted BouskillConnect With a Mentor Senior Software DeveloperCommented:
Application name in the connection string is optional but is great for debugging purposes on the SQL server side.  You can actually monitor SQL connections using it.

The name='' attribute is so that you can use multiple SQL providers with one being the default.
0
 
kvnsdrAuthor Commented:
So, as is, my current web.config is usable?

How would you improve it?
0
 
Ted BouskillConnect With a Mentor Senior Software DeveloperCommented:
Yep your current file is fine.  I'd change one line: applicationName="AspNetSqlProvider"

Instead of a generic name use the name of your actual application.  It's easier to spot when debugging SQL using the Profiler.

If your application name is "My Cool Application" use applicationName="My Cool Application"
0
All Courses

From novice to tech pro — start learning today.