473,804 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customizing the MembershipProvi der without starting from scrap

Hi all,

I'd like to write my own MembershipProvi der for my ASP.NET 2.0 web
application but I fear all the code to write. Basically, I only want to
add a few functionalities like being able to change a username (which
the standard MembershipProvi der does not allow), add some fields to a
user (e.g.: "Area", a few others...) and some other functions I may not
think of right now.

How could I write my own MembershipProvi der while still enjoying the
standard built-in functionalities like password salting and hashing and
all the advanced functions that I do not want to re-code? Is there a
simple way to add functionalities rather than modifying the whole
package?

Thank you very much for your help,

ibiza

Jan 23 '06 #1
5 3265
Ibiza,
You could try creating a new MembershipProvi derEx class that derives from
the existing class and see if you can add your desired functionality that
way, without having to "reinvent the wheel". Otherwise, they provide a sample
Class template and its not that difficult to write a new one.

Here's an example of two I did for the SQLite database:

http://www.eggheadcafe.com/articles/20051119.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ibiza" wrote:
Hi all,

I'd like to write my own MembershipProvi der for my ASP.NET 2.0 web
application but I fear all the code to write. Basically, I only want to
add a few functionalities like being able to change a username (which
the standard MembershipProvi der does not allow), add some fields to a
user (e.g.: "Area", a few others...) and some other functions I may not
think of right now.

How could I write my own MembershipProvi der while still enjoying the
standard built-in functionalities like password salting and hashing and
all the advanced functions that I do not want to re-code? Is there a
simple way to add functionalities rather than modifying the whole
package?

Thank you very much for your help,

ibiza

Jan 23 '06 #2
wow, I looked at your code and it seems pretty complete...too much for
me! :\

unfortunately, I tried just the following to check the minimum I had to
code :

public sealed class test : MembershipProvi der {}

and I have something like 25+ functions to override, from createuser to
changepassword, lockuser and more...isn't there a way to only *add* the
few functions we want more on the standard MembershipProvi der? I'm kind
of discouraged.. :S

thanks a lot

ibiza

Jan 23 '06 #3
You don't have to override every method. Or if you want, you can do so and in
the method body just call
base.MethodName ();
and you are done.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ibiza" wrote:
wow, I looked at your code and it seems pretty complete...too much for
me! :\

unfortunately, I tried just the following to check the minimum I had to
code :

public sealed class test : MembershipProvi der {}

and I have something like 25+ functions to override, from createuser to
changepassword, lockuser and more...isn't there a way to only *add* the
few functions we want more on the standard MembershipProvi der? I'm kind
of discouraged.. :S

thanks a lot

ibiza

Jan 24 '06 #4
That's a great idea! I'll try it and let you know if it works or I
encounter any problem :)

Thanks!

ibiza

Jan 24 '06 #5
Hi,

ok, first problem...

I use VB.NET to code, I hope it does not bother you (too much)!

But here is what I tried:

public class test : Inherits MembershipProvi der
public overloads overrides function ChangePassword( username as
string, oldPassword as string, newPassword as string) as boolean
return mybase.ChangePa ssword(username , oldPassword,
newPassword)
end function
end class

and here's what it throws : "MyBase cannot be used with method 'Public
MustOverride Function ChangePassword( username as string, oldPassword as
string, newPassword as string' As Boolean because it is declared
'MustOverride'. "

So I guess I HAVE to override every single 'MustOverride' function and
can't just call the base function...am I correct? :S

thanks, your help is greatly appreciated

Bruno

Jan 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1654
by: Erwin Moller | last post by:
Hi, Bad EU behaviour. :-( source: http://lwn.net/Articles/84301/ Regards, Erwin Moller (The Netherlands)
3
2088
by: Diego | last post by:
I've created a Custom MembershipProvider, in the user creation i have to return somehow the ProviderUserKey but inside the MembershipProvider I have no access to the session to store the info. Any suggesions appreciated. Thanks, Diego
5
2559
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called "Enlighten.LinkMad.Businesslogic". In one of my frontend websites I use this type to authenticate a user who is trying to login. The following excerpt is from the web.config of the particular site showing the reference to the custom provider, allowing .Net to do...
3
8350
by: John | last post by:
Hi I am using create user wizard with sql server based membership/roles. I have the following questions; 1. How can I get rid of the security question and answer as I don't need it in my app? 2. How can I get the control to send an email to the "office" so they can authorise the account before it can be activated for the user?
2
2635
by: Mark Olbert | last post by:
So far, I am more than a little underwhelmed by the Membership API in ASPNET2, and the ASP.NET Configuration wizard in VS2005. The latter is slow as a pig whenever it does anything. Oh well, at least it's given me a chance to brush up on my Spider Solitaire game. In any event, I am trying to implement a custom MembershipProvider for a website. Why? Because the default one that gets created by the supplied wizard is way over the top, in...
0
1561
by: Cooper Blake | last post by:
Hello, I'm trying to unit test an asp.net application. We are using the .net 2..0 authentication / loginView, etc. web controls, with a customized MembershipProvider (MP) class to connect to an Oracle database. NUnit is our unit testing framework, and I want to test the creation of a user in the database. NUnit loads the web.config file just fine, and can connect to the database using configuration settings. I can...
3
1629
by: daokfella | last post by:
I'm just starting to dive into the new membership stuff and wondering if it is possible to customize the default membership architecture in ASP.Net 2.0 to do the following: Instead of UserName and Password for the login account, I want E-mail Address and Password as the main login credentials. I'd also like to store additional info such as Name, Address, Nickname, and Bio. I also want the e-mail address and nicknames to both be unique. ...
4
4747
by: freeflytim | last post by:
I'm trying to implement a custom MembershipProvider (and RoleProvider) together with a custom MembershipUser class in C#, Asp.Net 2.0, MS Visual Studio 2005. Everything has worked fine so far, all compiles, then I try to run the Website administration tool (WAT). I can bring up the main web page of the tool, but as soon as I click on 'Security', I get this error: Type is not resolved for member 'TC.Providers.TCMembershipUser,TC,...
5
3576
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the creation of content which adjusts based on the user. I have several pages which require a user to be logged on and several which do not. Prior to this point in time I have used 2 different master pages. one with a control which checks a session...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.