membership/role authentication using MySql

Discussion in 'ASP.NET / ASP.NET Core' started by triggagnome, Aug 9, 2011.

  1. I am having trouble configuring my web site to work properly using mysql membership/role provider. I have a login page for a particular section of the site and when I click the login button I get the following error message:

    I have set the trust level to full in web.config as well as contacted DASP tech support. Since this issue, according to DASP, is not a hosting issue, I am hoping that someone else can help. You can see the error page for yourself if you'd like by going to:

    http://rjscondo.com/test/login.aspx

    Any suggestions will be greatly appreciated.
     
  2. So after further investigation, I was able to fix this problem.

    The following post was exactly what I needed:

    http://forums.mysql.com/read.php?38,234752,234752#msg-234752

    I wasn't sure exactly how to accomplish this because I was using DASP's default MySqlMembership provider.

    This is what my web.config looked like:

    Code:
    <configuration>
    	<connectionStrings>
    		<add name="rjscondoLiveConnectionString" connectionString="server=db4free.net;User Id=uid;password=pw;Persist Security Info=True;database=db" providerName="MySql.Data.MySqlClient"/>
    		<add name="MySqlMembershipConnection" connectionString="Data Source=db4free.net;user id=uid;password=pw;database=db;" providerName="MySql.Data.MySqlClient"/>
    	</connectionStrings>
    	<system.web>
        <trust level="Full"/>
    		<authentication mode="Forms">
       <forms name=".ASPXFORM$" loginUrl="~/login.aspx" />
      </authentication>
    		<membership defaultProvider="MySQLMembershipProvider">
          <providers>
    		</membership>
    		<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
    		</roleManager>
    		<profile>
    			<providers>
    			</providers>
    		</profile>
    		<compilation debug="true" targetFramework="4.0">
    			<assemblies>
    				<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
    		</compilation>
    	</system.web>
    	<system.net>
    		<mailSettings>
    			<smtp from="[email protected]">
    				<network host="smtp.rjscondo.com" password="pw" userName="un"/>
    			</smtp>
    		</mailSettings>
    	</system.net>
    </configuration>
    
    This is what it looks like now:

    Code:
    <configuration>
    	<connectionStrings>
    		<add name="rjscondoLiveConnectionString" connectionString="server=db4free.net;User Id=uid;password=pw;Persist Security Info=True;database=db" providerName="MySql.Data.MySqlClient"/>
    		<add name="MySqlMembershipConnection" connectionString="Data Source=db4free.net;user id=uid;password=pw;database=db;" providerName="MySql.Data.MySqlClient"/>
    	</connectionStrings>
    	<system.web>
        <trust level="Full"/>
    		<authentication mode="Forms">
       <forms name=".ASPXFORM$" loginUrl="~/login.aspx" />
      </authentication>
    		<membership defaultProvider="MySQLMembershipAppProvider">
          <providers>
            <clear/>
            <add name="MySQLMembershipAppProvider"
              type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
              autogenerateschema="true"
              connectionStringName="MySqlMembershipConnection"
              enablePasswordRetrieval="false"
              enablePasswordReset="true"
              requiresQuestionAndAnswer="false"
              applicationName="/"
              requiresUniqueEmail="true"
              passwordFormat="hashed"
              hashAlgorithmType="SHA1"
              maxInvalidPasswordAttempts="7"
              minRequiredPasswordLength="6"
              minRequiredNonalphanumericCharacters="0"
              passwordAttemptWindow="10"
              writeExceptionsToEventLog="false" />
          </providers>
    		</membership>
    		<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
    		</roleManager>
    		<profile>
    			</providers>
    		</profile>
    		<compilation debug="true" targetFramework="4.0">
    			<assemblies>
    				<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
    		</compilation>
    	</system.web>
    	<system.net>
    		<mailSettings>
    			<smtp from="[email protected]">
    				<network host="smtp.rjscondo.com" password="pw" userName="un"/>
    			</smtp>
    		</mailSettings>
    	</system.net>
    </configuration>
    
    So far everything looks good. Hope this can help someone else.
     

Share This Page