Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > custom sqlmembership provider

Reply
Thread Tools

custom sqlmembership provider

 
 
Rafia Tapia
Guest
Posts: n/a
 
      05-04-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
 
 
 
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      05-06-2010
Hi Rafia Tapia,

To configure the application to use the custom Membership Service, we need
to add a section named membership under the system.web node to the
web.config file. The Membership section can have multiple providers listed
within the providers subsection, using the add element once for each
provider.

Here is a simple demo.

<system.web>
<membership>
<providers>
<add name="MembershipSqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="AspNetMembershipDatabase" />
</providers>
</membership>
</system.web>

Please have a check with the setting in the web.config file of your
application to see whether the error is caused by missing this part.

For more information about how to build custom Providers, you can refer to
this link: http://msdn.microsoft.com/en-us/library/aa479048.aspx

If I have misunderstood you, please feel free to tell me.

--
Sincerely,
Zhi-Qiang Ni
Microsoft Online Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================

 
Reply With Quote
 
 
 
 
Rafia Tapia
Guest
Posts: n/a
 
      05-07-2010
I have made all the appropriate changes in the config file. My question is
more on the implementation rather than the configuration of custom provider

"Zhi-Qiang Ni[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Rafia Tapia,
>
> To configure the application to use the custom Membership Service, we need
> to add a section named membership under the system.web node to the
> web.config file. The Membership section can have multiple providers listed
> within the providers subsection, using the add element once for each
> provider.
>
> Here is a simple demo.
>
> <system.web>
> <membership>
> <providers>
> <add name="MembershipSqlProvider"
> type="System.Web.Security.SqlMembershipProvider"
> connectionStringName="AspNetMembershipDatabase" />
> </providers>
> </membership>
> </system.web>
>
> Please have a check with the setting in the web.config file of your
> application to see whether the error is caused by missing this part.
>
> For more information about how to build custom Providers, you can refer to
> this link: http://msdn.microsoft.com/en-us/library/aa479048.aspx
>
> If I have misunderstood you, please feel free to tell me.
>
> --
> Sincerely,
> Zhi-Qiang Ni
> Microsoft Online Support
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
> MSDN Managed Newsgroup support offering is for non-urgent issues where an
> initial response from the community or a Microsoft Support Engineer within
> 2 business day is acceptable. Please note that each follow up response may
> take approximately 2 business days as the support professional working
> with
> you may need further investigation to reach the most efficient resolution.
> The offering is not appropriate for situations that require urgent,
> real-time or phone-based interactions. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
> ==================================================
>



 
Reply With Quote
 
Zhi-Qiang Ni[MSFT]
Guest
Posts: n/a
 
      05-12-2010
Hi Rafia Tapia,

Sorry for the late reply.

So based on my understanding, you need to add some own fields into the
membership data table to extend the original feature.

If so, I would like to strongly recommend this article talking about the
way to extend Membership API to accommodate custom member records with a
solution working upon it.

Microsoft ASP.NET 2.0 Membership API Extended:
http://www.devx.com/codemag/Article/34492/1954

I believe this can help us make the goal.

--
Sincerely,
Zhi-Qiang Ni
Microsoft Online Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
custom sqlmembership provider Rafia Tapia ASP .Net 0 05-04-2010 05:18 PM
SqlMembership Provider without dbo owner Mike Endys ASP .Net 6 06-22-2009 04:10 AM
Custom Membership Provider - Custom Error Messages Brett Ossman ASP .Net Security 0 03-11-2009 09:33 PM
Unable to redirect when using custom 'Login' with custom 'Membership provider' asnowfall@gmail.com ASP .Net 0 06-05-2007 05:15 PM
Informix .net provider - Sql server .net provider BS ASP .Net 3 06-17-2004 01:11 AM



Advertisments