Has anyone had any success using the ASP.NET Login Controls and the Membership API with NHibernate? Any sample apps or tutorials?
I currently have a simple web page created that uses NHibernate to view all users from a database including information from multiple tables, add new users (just using a table definition and text boxes), and edit existing users.
I now want to be able to add users to the database using the ASP.NET Login Controls. I have used the "asp_regsql.exe" to add the required membership tables to my existing database. I have included a copy of the web.config file as I was instructed to include the "MyMembershipConnString" connectionString tag and the "MyMembershipProvider" in the membership tag. When I try to build the solution, it generates the following error (line 10 is the opening nhibernate tag):
Unrecognized configuration section nhibernate in web.config line 10
Code:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="MyMembershipConnString"
connectionString="Data Source=YOUR-F8A010A9D0\SQLEXPRESS;Initial Catalog=LIFECLOUD;Integrated Security=True" />
</connectionStrings>
<appSettings>
<add key="HBM_ASSEMBLY" value="Lifecloud.Core"/>
</appSettings>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<add key="hibernate.connection.connection_string" value="Data Source=YOUR-F8A010A9D0\SQLEXPRESS;Initial Catalog=LIFECLOUD;Integrated Security=True"/>
<add key="hibernate.connection.isolation" value="ReadCommitted"/>
<add key="hibernate.default_schema" value="LIFECLOUD.dbo"/>
</nhibernate>
<system.web>
<authentication mode="Forms" />
<authorization>
<deny users="?" />
</authorization>
<membership defaultProvider="MyMembershipProvider">
<providers>
<add connectionStringName="MyMembershipConnString" applicationName="/Lifecloud"
enablePassworRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Hashed" name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
<httpModules>
<add name="NHibernateSessionModule" type="Lifecloud.Web.NHibernateSessionModule"/>
</httpModules>
<compilation debug="true">
<assemblies>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
</system.web>
</configuration>
I am trying to follow instructions on the membership API from the book, "Pro ASP.NET 2.0 in C# 2005" from APress. Any help would be appreciated,