This project is read-only.

SqlMembershipProvider with existing web application

Topics: ASP.NET 2.0
Jul 31, 2008 at 10:25 AM
I'm having a little trouble getting 1.4 to work with an existing web application which is already using the aspnet membership provider.

I've changed the applicationName keys to match those in aspnet_Application. BE seems to let me log in, and the WSAT shows all my users and roles, but BE is not picking up the roles relationship properly. I changed this key ...
<add key="BlogEngine.AdminRole" value="Administrator"/>
...because the default value was "AdminsistratorS" with an S... I assume this has to match the name of the role from aspnet_roles that I wish to use as the admin? Or am I wrong here?

I've also changed the machinekey to the one that is working with the existing application.

Any help MUCH appreciated.

Aug 7, 2008 at 3:35 PM
Hey concise.

This had me stumped for a while too.

The missing link is the admin/pages/web.config file.  This has a whole load of location configurations that limit access to different pages based on the roles.  Basically, you were logged in okay with the correct role, but that role still wasn't allowing you to see the administration pages.

So, open up this .config file, and search and replace "Administrator" with "AdministratorS". Save and you're done!

Of course it would be nice if this config file somehow knew which role you were using, but I'm not sure that's possible.  And this isn't a hard fix once you know about it.  I was just glad to find the name of the role hadn't been hardcoded - this makes it much easier to integrate with my existing database.  Good job guys!
Aug 7, 2008 at 4:13 PM
Hi, as my email indicates,  I'm new to setting up a blog.  I would also like to integrate BE with an existing application, and run it in a subdirectory.  I plan to convert my custom login authentication tables over to the aspnet membership provider so I installed the membership / roles tables into my DB and created Administrators and Editors roles and then created two users, one of them in Administrators Role.    Thanks Al Nyveldt for your awesome tutorials!!  I modified the web.config in my subdirectory to use DbMembershipProvider and DbRoleProvider instead of XML..but when I attempt to login using the newly created users, I get 'Your login attempt was not sucessful...'   I can see the users I created in the .net membership tables,  but BE won't allow me to login with anything other than the admin/admin user,  seems like it just isn't using aspnet membership?  Can someone help me understand all the steps necessary to integrate BE into an existing application?  I want to authenticate users once and not have them login to the blog. 

Any help is greatly appreciated,  I have been using .net for about six months now and am trying to come up to speed.