Click here to Skip to main content
6,305,776 members and growing! (17,913 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:13,625
Bookmarked:31 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
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
Company information: 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 24 of 24 (Total in Forum: 24) (Refresh)FirstPrevNext
GeneralHydrating from EFExtensions Pinmemberjonranes0:24 13 Mar '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  
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  
Generalfor dotnet2.0 not linq Pinmemberhungud21:05 9 Nov '08  
AnswerRe: for dotnet2.0 not linq PinmemberMichael Ulmann23:54 9 Nov '08  
RantRe: for dotnet2.0 not linq Pinmemberhungud0:44 10 Nov '08  
GeneralRe: for dotnet2.0 not linq PinmemberAlexRiley9:25 14 Feb '09  
GeneralRe: for dotnet2.0 not linq PinmemberMichael Ulmann12:31 15 Feb '09  
GeneralMissing providers PinmemberRoger Jakobsson12:10 3 Nov '08  
AnswerRe: Missing providers PinmemberMichael Ulmann22:54 5 Nov '08  
GeneralJust another code dump... PinmvpDave Kreskowiak13:53 29 Oct '08  
GeneralRe: Just another code dump... PinmemberMichael Ulmann14:45 29 Oct '08  
GeneralRe: Just another code dump... PinmvpDave Kreskowiak16:41 30 Oct '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
Web16 | Advertise on the Code Project