views:

164

answers:

1

I am reading through the book ASP.NET MVC 1.0 Website Programming and the following is contained within the web.config file in the example project:

    <authentication mode="Forms">  
        <forms defaultUrl="/" loginUrl="/user/login" />  
    </authentication>  
    <membership>  
        <providers>  
            <clear />  
            <add name="AspNetSqlMembershipProvider"  
                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"  
                 connectionStringName="TheBeerHouseConnectionString"  
                 enablePasswordRetrieval="false"  
                 enablePasswordReset="true"  
                 requiresQuestionAndAnswer="false"  
                 applicationName="TheBeerHouse"  
                 requiresUniqueEmail="true"  
                 passwordFormat="Hashed"  
                 maxInvalidPasswordAttempts="5"  
                 minRequiredPasswordLength="5"  
                 passwordAttemptWindow="10"  
                 passwordStrengthRegularExpression=""  
            />  
        </providers>  
    </membership>

I understand everything minus the Culture and PublicKeyToken decleratinos contained within Membership / Providers / Add / Type

Could anyone help me to understand these two aspects?

+1  A: 

In the 'type' field you are basically specifying the .net type which will impliment the membership provider, and the assembly which contains it.

Regarding the specific elements you are asking about:

Culture parameter: is used to specify localised versions of the assembly/type. Usually this is just 'neutral'.

PublicKeyToken: When refering to an assembly with this kind of identifier string, the PublicKeyToken is a hash of the public key related to the signed assembly (dll). In this case I assume it is the PublicKeyToken of the system.web assembly.

UpTheCreek
If the PublicKeyToken is simply pointing to the System.Web.dll that I am already referencing earlier in the same line then what exactly is the purpose? Do I need the PublicKeyToken? Is there an instance it might make sense not to include it and another situation where it would?
mynameiscoffey
I imagine the purpose of additionally specifying the publickeytoken is to ensure you are referencing the genuine (signed) dll.
UpTheCreek