These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ASP.NET Login Controls and NHibernate
PostPosted: Sun Nov 05, 2006 5:07 pm 
Newbie

Joined: Fri Sep 29, 2006 11:13 pm
Posts: 10
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,

_________________
Thank you,
Susan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 5:57 am 
Beginner
Beginner

Joined: Thu Oct 19, 2006 1:03 pm
Posts: 29
Your exception and error are separate questions.

To get rid of your exception: add this:
Code:
<configSections>
      <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.1.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
   </configSections>


Furthermore, you'll encounter an exception, because unless you have explicitly written a class
Code:
MyMembershipProvider
and in that inherited MembershipProvider, it won't work.

You'll have to write a custom membership provider to work with NHibernate.


Top
 Profile  
 
 Post subject: Re: ASP.NET Login Controls and NHibernate
PostPosted: Wed Nov 29, 2006 10:24 pm 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
Quote:
Has anyone had any success using the ASP.NET Login Controls and the Membership API with NHibernate? Any sample apps or tutorials?


Are you still looking for this sample? Did you manage to find a sample somewhere? I have been playing with NHibernate using the MembershipProvider and RoleProvider implementations and I have full integration with the ASP.NET Web Site Administration Tool. I don't know if that would be of interest to you. I have tested the implementation so far using MS SQL and Oracle.

It still needs some work, as I am using it to play with NHibernate. I would be interested in comments on the implementation, especially regarding the NHibernate use. Let me know.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 3:36 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
I'd be interested in your work .. I'd like to write a Provider to work with Membership and Role using NHibernate.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 9:12 pm 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
No problem. I don't use the default ASP.NET tables. I create my own because I am trying to include support to manage all users for a number of applications, not just one.

I have the model in Visio for Enterprise Architects. Can you tell me if this would be good for you or do you prefer a script to create the tables? If so, can you tell me which database you will be using? I can see if I can create the script for you.

Once I know this I can package the code and send it your way. It also comes with a sample application.

Also, can you tell me which version of NHibernate you are using? I am using 1.0.3. I have not had a chance to test using 1.2 beta, but I trust it will be fine.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 12:03 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
VIsio is fine.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 4:15 pm 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
How about an e-mail address?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 4:44 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
Hey, I'm from Quebec City :)

try mart_bl at hotmail


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 7:38 pm 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
I just sent it. Let me know if you do get my e-mail and if the attachment came through correctly.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 8:10 am 
Beginner
Beginner

Joined: Wed Aug 30, 2006 2:06 am
Posts: 24
Hi, I am interested in the sample for nhibernate with membership and roleprovider implementation?
I will send my mail details. Let me know...

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 8:45 am 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
No problem. Post your e-mail.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 9:59 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
I'm also interested. My email is: carl.arnesten [at] stratsys.se

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 12:13 pm 
Newbie

Joined: Wed Nov 02, 2005 9:52 am
Posts: 18
Location: Argentina
I'm interested too.
My email is: antares_dark2 [at] yahoo.com.ar
Can you send me?

Thanks!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 1:01 pm 
Beginner
Beginner

Joined: Wed Aug 30, 2006 2:06 am
Posts: 24
My Mail id is vjanakiram@yahoo.com

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 9:42 am 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
I created a GotDotNet project where you can find the files. You can go directly to the project site by following this link (click me). I hope you find the sample code useful. Please provide help in the areas where I may be falling short to make this implementation better. Cheers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.