Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

.NET Add Parameters to Membership CreateUser function

Posted on 2009-07-03
1
Medium Priority
?
879 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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