Click here to Skip to main content
6,595,444 members and growing! (21,593 online)
Email Password   helpLost your password?
Web Development » Web Security » Security     Intermediate License: The Code Project Open License (CPOL)

Custom membership provider for the ADO.NET Entity Framework

By Michael Ulmann

Custom membership provider implementation for the ADO.NET Entity Framework.
C#, Javascript, XML, CSS, HTML, XHTML, ASP, ASP.NET, WebForms, Ajax, Dev
Posted:29 Oct 2008
Views:18,897
Bookmarked:33 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
13 votes for this article.
Popularity: 4.10 Rating: 3.68 out of 5
1 vote, 7.7%
1
1 vote, 7.7%
2
2 votes, 15.4%
3
1 vote, 7.7%
4
8 votes, 61.5%
5

Introduction

This article describes the implementation of a custom membership provider for the ADO.NET entity framework. The code presented in this article fully complies with Microsoft's provider model design pattern. It also leverages the LINQ to Entities feature introduced with framework 3.5.

Background

It is required to have a basic understanding of the ADO.NET Entity Framework and the ASP.NET membership provider model in order to successfully integrate the presented solution.

Using the code

To configure the attached sample, the following steps have to be taken into account:

  1. Create a database (e.g., EFDataModel).
  2. Run the CreateUserTable.sql script located in the DatabaseScripts solution folder.
  3. Modify the connection string for the Entity Framework in the App.config file of the SmartSoft.EFMembershipProvider.DataLayer project.
  4. Modify connection string for the Entity Framework in the Web.config file of the Web application.

If you want to integrate the custom membership provider into your existing application, you might have to replace the object context EFDataModelEntities within the membership provider class according to your entity model.

Depending on your data model, the method DeleteUser within the membership provider class has to be extended from line 698 onwards in order to delete/mark all user related data.

History

  • 29/10/2008 - Initial article posted.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Michael Ulmann


Member
MCAD, MCPD Web Developer
Visit my Space: http://ukmichael.spaces.live.com
www.smart-soft.ch
Occupation: Software Developer (Senior)
Company: Smart-Soft
Location: Australia Australia

Other popular Web Security articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 35 (Total in Forum: 35) (Refresh)FirstPrevNext
GeneralHow can we insert values into FirstName,LastName fields in the Db PinmemberMember 347355312:52 4 Aug '09  
GeneralRole and Profile providers Pinmembershapper10:18 27 Jul '09  
GeneralRe: Role and Profile providers PinmemberMichael Ulmann1:40 30 Jul '09  
GeneralRe: Role and Profile providers Pinmembershapper7:04 31 Jul '09  
GeneralRe: Role and Profile providers PinmemberMichael Ulmann22:43 31 Jul '09  
GeneralRe: Role and Profile providers PinmemberMichael Ulmann0:47 1 Aug '09  
GeneralAdd'l Providers PinmemberJeff Bowman11:19 24 Jul '09  
GeneralRe: Add'l Providers PinmemberMichael Ulmann15:10 1 Aug '09  
GeneralRe: Add'l Providers PinmemberJeff Bowman20:00 1 Aug '09  
GeneralHydrating from EFExtensions Pinmemberjonranes0:24 13 Mar '09  
GeneralRe: Hydrating from EFExtensions PinmemberMichael Ulmann15:10 1 Aug '09  
GeneralMy vote of 2 Pinmemberandrewward3:11 16 Feb '09  
GeneralAre the other providers ready? Pinmemberjetset329:49 11 Jan '09  
AnswerRe: Are the other providers ready? PinmemberMichael Ulmann12:34 11 Jan '09  
GeneralRe: Are the other providers ready? Pinmemberjetset329:22 12 Jan '09  
GeneralRe: Are the other providers ready? PinmemberRoger Jakobsson12:01 13 Feb '09  
GeneralRe: Are the other providers ready? PinmemberMichael Ulmann15:10 1 Aug '09  
GeneralA forgotten thing PinmemberFatihSever16:17 2 Dec '08  
QuestionRe: A forgotten thing Pinmemberalibaba0690:37 9 Dec '08  
AnswerRe: A forgotten thing PinmemberFatihSever2:09 12 Dec '08  
GeneralRe: A forgotten thing PinmemberMichael Ulmann18:12 15 Dec '08  
QuestionAdding an entry in the DB Pinmemberalibaba0691:19 1 Dec '08  
GeneralThanks a lot PinmemberFatihSever12:26 26 Nov '08  
JokeRe: Thanks a lot Pinmemberalibaba0699:32 29 Nov '08  
AnswerRe: Thanks a lot PinmemberMichael Ulmann12:24 30 Nov '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 29 Oct 2008
Editor: Smitha Vijayan
Copyright 2008 by Michael Ulmann
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project