Moving From Casini to IIS, Login Fails. How come?

ASP.NET 2.0 Membership

A very common question that comes up while using ASP.NET 2.0 Membership is that when moving a web application from the local developer environment with Visual Studio 2005 (VS2005) to IIS is that login no longer works. Almost everytime this happens, it comes down to the application name in the Membership Profile of Web.Config is set to / instead of the actual application name. That is, if you you were to look at your web.config, this is what you would see.

<roleManager enabled=“true/>
     <membership>
          <providers>
          <remove name=“AspNetSqlMembershipProvider/>
          <add name=“AspNetSqlMembershipProvider
               type=“…“
               connectionStringName=“LocalSqlServer
               enablePasswordRetrieval=“false
               enablePasswordReset=“true
               requiresQuestionAndAnswer=“true
               applicationName=“/“
               requiresUniqueEmail=“false
               minRequiredPasswordLength=“1
               minRequiredNonalphanumericCharacters=“0
               passwordFormat=“Hashed
               maxInvalidPasswordAttempts=“5
               passwordAttemptWindow=“10p=“”
               asswordStrengthRegularExpression=“”/>
     </providers>
</membership>

Notice that the applicationName is set to just a "/". To make the application work with IIS, you really need to set that to the name of your application. That is, the correct way to specify applicationName is something more like this:

<roleManager enabled=“true/>
    <membership>
        <providers>
            <remove name=“AspNetSqlMembershipProvider/>
            <add name=“AspNetSqlMembershipProvider
                type=“…“
                connectionStringName=“LocalSqlServer
                enablePasswordRetrieval=“false
                enablePasswordReset=“true
                requiresQuestionAndAnswer=“true
                applicationName=“/MyCoolApp1
                requiresUniqueEmail=“false
                minRequiredPasswordLength=“1
                minRequiredNonalphanumericCharacters=“0
                passwordFormat=“Hashed
                maxInvalidPasswordAttempts=“5
                passwordAttemptWindow=“10p=“”
                asswordStrengthRegularExpression=“”/>
        </providers>
    </membership>

This also makes it so that you can share the same membership database across multiple applications.

About Peter Kellner

Follow me:


Comments

  1. pelangi casino online says:

    it appears that you’ve put numerous effort and efforts into your article and you want much more of using the net lately. I sincerely obtained a kick out of your post. I don’t absolutely have much to mention in response, I only wanted to comment to response wonderful work..

  2. thought provoking post! I think that aids me very well. Answers a number of worries for me. Many thanks

  3. Hello
    I loose control!
    Free java casino no download
    casino
    List flash no download casino
    casino
    Virtual casino birthday welcome bonus
    casino
    Flash no download casino without deposit
    casino
    Internet poker web sites

  4. Administrator says:
Follow

Get every new post delivered to your Inbox

Join other followers: