Solved

.NET Add Parameters to Membership CreateUser function

Posted on 2009-07-03
1
829 Views
Last Modified: 2012-05-07
I'm creating login functionality for my website using an access database.  Everything works until I try to add customized parameters such as first name, last name, phone number, etc.  I realized that all I really need to get everything to work is to add the new parameters to the CreateUser function in the AccessMembershipProvider.cs file.  However, I can't find where this function is called.  Where fild containing the code that calls CreateUser when the user hits the "Create User" button in the membership form?  I put the first line of the function below, with the parameters that I'm trying to add commented out.
Thanks!
public override MembershipUser CreateUser(string username,

                                           string password,

                                 //          string firstname,

                                 //          string lastname,

                                 //          string phoneNumb,

                                           string email,

                                           string passwordQuestion,

                                           string passwordAnswer,

                                           bool isApproved,

                                           object userId,

                                           out    MembershipCreateStatus status) {
 

//Code here
 

}

Open in new window

0
Comment
Question by:atuccillo
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24775105
You cannot modify createuser method definition i.e. pass additional parameters.
Also there is not way to catch CreateUser event...
I do remember some way out in this case ...but cannot recall or don't have references handy.
But here is one option that you can try and it will work as well.
CreatedUser Event - where again you have two choices.
1: Use Asp.net Profiles. But I am never used AccessProfileProviders(not sure even if one exists)
Check this link: http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx
It user SqlProfileProvider but you might find somewhere AccessProfileProvider.

2: Create your own UserProfiles table. Link it with aspnet_Users table using UserId as FK relationship.
Now in CreatedUser Event handler, insert FN,LN,BD etc field values into UserProfiles Table
Check this:
http://weblogs.asp.net/gurusarkar/archive/2009/01/27/storing-user-profile-into-a-custom-table-using-createuser-wizard-control.aspx

Now the link 2 above user SqlConnection/SqlCommand objects to insert values but in your case should use OleDbConnection/Command objects.

Option 1 and 2 are almost similar but in case 1, asp.net profile provider takes care of profiletable and insert/update mechanism but in case 2, you do it manually by youself.
The concept remains same to use CreatedUser Event of CUW control.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now