Register   |   Login

 

Spark Your Solution

 Scott's Technology Blog Minimize

Mar 18

Written by: Scott Davis
3/18/2008 10:46 PM

On and off over the past few weeks I've been experiencing the hard knocks of using ASP.Net 2.0 profiles.  The most important lesson learned was this:  ProfileCommon is only available if you created your project as a "Web Site" not if you use a "Web Application".  Much to my disappointment, I reviewed many Microsoft articles and MVP blogs the talked of the many benefits of the ProfileCommon class, all failing to mention that you must use a Web Site project.

This is a nice little post that I finally found.

http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx

I prefer the Web Application project for a variety of reasons.  The difference between the two isn't well understood, and I admit that I don't know them all myself, but it is worth a little research for every .Net web developer.  Maybe I will include them in a future post.

So, back to profiles, this is an excellent guide for getting started with profiles and membership.

http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

So, like most people, you are probably going to want to extend the profile to include things like first name, last name, etc.  One of the issues with using the default profile storage is that the profile is stored in one big text blob in the database.  If you are like me, you want to be able to query for users that live in a certain state, and so on.  For this, there is a table based profile provider available from Microsoft at:

http://www.asp.net/downloads/sandbox/table-profile-provider-samples/

While it was nice to review how this code was implemented, in the end I decided to write my own profile class following the sample in the first link above.  I felt there was a simpler way to implement the table driven profile and wanted to build one that used stored proc access, which appeared to require just about as much work as using the stored proc version in this sample.

Given a bit more time, I may clean up my implementation and post it here. Stay tuned. 

Good luck with profiles.  It can be a tough one to get your hands around initially, but it is worth the effort to gain the benefit of all the membership gadgets you can use. 

 

Tags:

Your name:
Title:
Comment:
Add Comment    Cancel  

  
 Blog Dates Minimize

 Print   
 Search Minimize

 Print