PC Review


Reply
Thread Tools Rate Thread

custom sqlmembership provider

 
 
Rafia Tapia
Guest
Posts: n/a
 
      4th May 2010
Hi,
I have added couple of fields in the membership table. I want to expose
those additional fields through membership user. I understand that I need to
provide my own implementation of membershipprovider and membershipuser
class. Since the sqlmembership provider provides most of the functionality I
need, I thought of using a sqlmembership provider internally within my
custom provider to provide lot of the implementation. So my code is

class MyMemberShipProvider : MembershipProvider
{
private SqlMembershipProvider _DefaultSqlProvider;

// I then implement the abstract methods of MembershipProvider by simply
calling sqlmembershipprovider function so for instance my implementation of
change password is

public override bool ChangePassword(string username, string oldPwd,
string newPwd)
{
return SqlProvider.ChangePassword(username, oldPwd, newPwd);
}

//I have also implemented the initialize method as
if (config == null)
throw new ArgumentNullException("config");

if (name == null || name.Length == 0)
name = "MyMembershipProvider";

if (String.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Custom Membership provider");
}

// Initialize the abstract base class.
base.Initialize(name, config);

SqlProvider = new SqlMembershipProvider();
SqlProvider.Initialize(name, config);

}

but now I get an error that the provider name cannot be null or empty. Can
anyone please tell me what I am doing wrong. Also is my approach the correct
way of exposing some couple of additional fields in the database membership
table


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SqlMembership Provider without dbo owner Mike Endys Microsoft ASP .NET 5 10th Feb 2009 08:12 AM
Overriding SQLMemberShip Provider DotNetNewbie Microsoft C# .NET 2 17th Dec 2007 04:09 PM
Unable to redirect when using custom 'Login' with custom 'Membership provider' asnowfall@gmail.com Microsoft ASP .NET 0 5th Jun 2007 06:15 PM
Forward item custom form and pooling custom transport provider Tomislav Petrovic Microsoft Outlook Form Programming 3 25th Oct 2004 05:43 PM
Forward item custom form and pooling custom transport provider Tomislav Petrovic Microsoft Outlook Program Addins 0 19th Aug 2004 09:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.