Search code examples
asp.netwebformsprofileaspnetdb

Multiple Applications and one aspnetdb, problems with Profile


We are running several applications on the same aspnetdb. They are all using the same MembershipProvider. Sometimes we are getting "weird values" for Profile properties. It seems that the application is using data from a different application.

We already use different ApplicationName parameters.

Is there a way to clearly separate the applications without using distinct databases for the profiles?


Solution

  • This post is useful for what you need

    http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

    <membership>
                <providers>
                    <clear/>
                    <add name="AspNetSqlMembershipProvider"
                        type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                        connectionStringName="LocalSqlServer"
                        enablePasswordRetrieval="false"
                        enablePasswordReset="true"
                        requiresQuestionAndAnswer="true"
      requiresUniqueEmail="false"
                        passwordFormat="Hashed"
                        maxInvalidPasswordAttempts="5"
                        minRequiredPasswordLength="7"
                        minRequiredNonalphanumericCharacters="1"
                        passwordAttemptWindow="10"
                        passwordStrengthRegularExpression=""
                        applicationName="/"
                    />
                </providers>
          </membership>
    

    Add the same connectionstring for each application, and set different names in applicationName attribute