Coding in the name of's Profile User Rating: -----

Reputation: 67 Whiz
Active Members
Active Posts:
253 (0.12 per day)
07-July 10
Profile Views:
Last Active:
User is offline Yesterday, 06:24 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   Coding in the name of has not set their status

Posts I've Made

  1. In Topic: Authentication

    Posted 21 Apr 2016

    The MySQL identity database is working, I can register and login to my website. I want to control access by using authorization roles, but I don't know how I can create and administrate these roles. I am serving the website with IIS 8 on a Windows Server 2012 r2 computer.

    I believe .Net roles is the right section to look in for this but I get the error you can see here ( I also get this error when I click on the .NET Users section which has the default provider set to MySQLMembershipProvider (.NET Roles default provider is MySQLRoleProvider). I don't get this error going into the .NET Profile section which is using MySQLProfileProvider as default provider.

    I have also used the ASP.NET Web Site Administration Tool to set the Membership and Role providers for my app to MySQLMembershipProvider and MySQLRoleProvider. The security tab shows the error you can see in the third image in the album.

    I have tried to make these providers trusted by changing C:\Windows\System32\inetsrv\Config\administration.config's system.webServer section to this:

                <authentication defaultProvider="ConfigurationAuthenticationProvider">
                      <add name="ConfigurationAuthenticationProvider" type="Microsoft.Web.Management.Server.ConfigurationAuthenticationProvider, Microsoft.Web.Management, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
                <authorization defaultProvider="ConfigurationAuthorizationProvider">
                        <add name="ConfigurationAuthorizationProvider" type="Microsoft.Web.Management.Server.ConfigurationAuthorizationProvider, Microsoft.Web.Management, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
                <trustedProviders allowUntrustedProviders="false">
                    <add type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                    <add type="System.Web.Security.SqlRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                    <add type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    				<add type="MySql.Web.Security.MySqlMembershipProvider, MySql.Web, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    				<add type="MySql.Web.Security.MySqlRoleProvider, MySql.Web, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

    And by adding MySql.Web.dll, MySql.Data.dll, and MySql.Data.Entity.EF6.dll to the GAC. (

    I have done everything in those instructions except for the custom migration history context, MySQL doesn't have the 255 varchar limit any more so it doesn't seem necessary.

    My app's web.config has this for its entityFramework section:
          <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />

    and these sections as well:
        <authentication mode="Forms" />
        <compilation targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2" />
        <profile defaultProvider="MySQLProfileProvider" />
        <roleManager defaultProvider="MySQLRoleProvider" enabled="true" />
        <trust level="Full" />
        <membership defaultProvider="MySQLMembershipProvider" />
    	  <remove invariant="MySql.Data.MySqlClient"></remove>
    	  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=" />
          <remove name="FormsAuthenticationModule" />

    According to this post I need to use an ASP.NET Configuration Tool within Visual Studio, but I can't find this in VS Community.

    Apparently the solution is to make your own administration tool. http://www.dotnetfun...dentity-for-mvc

    This one's finally solved. Thanks again.
  2. In Topic: Authentication

    Posted 21 Apr 2016

    I've tried using the ASP.NET Web Site Administration Tool to set MySQLMembershipProvider as the app's membership provider and MySQLRoleProvider as the role provider. When I try to use the security tab in the admin tool I get this error: "There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled."

    Setting allowUntrustedProviders="true" in administration.config system.webServer/management/trustedProviders doesn't seem to allow the MySQL providers.
  3. In Topic: Authentication

    Posted 20 Apr 2016

    I managed to get my Entities stored in a MySql DB and it was a lot more painless than I thought. I just added the db context like this:

    public class SurveyDBContext : DbContext
        public SurveyDBContext()
            : base("SurveyConnection")
            Database.SetInitializer(new SurveyDbInitializer());
        public DbSet<CERO> Ceros { get; set; }

    And added the provider like so:

    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />

    The only remaining problem is authentication. I've changed the DefaultConnection string to point to my identity MySQL DB but when I try to use the register/login pages I get errors saying that table 'aspnet*' doesn't exist. I think it's looking for membership tables instead of identity tables, so I just need to figure out this last bit now. I'd be very grateful if you could give me some direction on this.

    I had the tables backwards. I let the ApplicationDbContext auto create the tables and it's all working. Easier than I thought but I kept finding conflicting information, probably for different versions or something. The last thing to get working will be roles.

    When I try to set the default provider to MySQLMembershipProvider it tells me I need to add it to the trusted section of a config file. But since it has the name Membership in it, can you tell me if this is the right thing or is it different for Identities?
  4. In Topic: Authentication

    Posted 19 Apr 2016

    Unfortunately I'm still lost on this. I don't know whether I should use Membership or Identity, or what the differences in implementation between either should be. I'm not sure how my Web.config should look because of this confusing section:

      <authentication mode="Forms" />
      <compilation debug="true" targetFramework="4.5.2" />
      <httpRuntime targetFramework="4.5.2" />
        <remove name="FormsAuthentication" />

    What I really want is to be able to use a MySQL database to store identities with roles working and, if possible, to store other entity framework data in another MySQL DB. And I'd like to use as much of the code that is generated for me in the template as possible, making minimal changes.

    I hope someone can explain this to me in words I can understand. Thanks.
  5. In Topic: Multi-page form

    Posted 17 Apr 2016

    Thanks for your advice, I think I'll look into AngularJS, I think there's a section on it in the Wrox ASP.NET MVC 5 book I have at the office. So if I use this I would basically use one action, view and model for the whole multi-page form and implement the pages by hiding/showing sections of the DOM?

    I see what you mean, I've played around with putting some JS to show/hide the sections, I think this will work well.

    Edit 2:
    Since I've brought everything into one big form and I'm just showing and hiding the relevant sections, if there are validation errors, how can I determine in which of the pages the errors occurred and which sections were validated so I can show the user?

    Edit 3:
    I solved this problem like so:
    foreach (string key in ViewData.ModelState.Keys.Where(k => k.StartsWith("Customer")))
        if (ViewData.ModelState[key].Errors.Any())
            model.CustomerInformationComplete = false;
    foreach (string key in ViewData.ModelState.Keys.Where(k => k.StartsWith("Landlord")))
        if (ViewData.ModelState[key].Errors.Any())
            model.LandlordInformationComplete = false;

My Information

Member Title:
D.I.C Regular
24 years old
March 31, 1992
Years Programming:

Contact Information

Click here to e-mail me



Page 1 of 1
  1. Photo

    ishkabible Icon

    19 Oct 2011 - 20:32
    your rep is a power of 2!!
  2. Photo

    c infant Icon

    15 Nov 2010 - 12:48
    thanks for the help m8, actually figured out where I was going wrong b4 looking at ur reply,but ur tips will come in handy for my next project.Thanks again c infant.
Page 1 of 1