?
Solved

.NET Add Parameters to Membership CreateUser function

Posted on 2009-07-03
1
Medium Priority
?
862 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

743 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