Solved

How to add/update an ASP.NET membership user profile?

Posted on 2010-09-17
3
841 Views
Last Modified: 2012-05-10
I am developing an admin interface that allow an admin user to create a number of user accounts (using ASP.NET Membership) and specify profile information for each user, e.g. first name, last name, client name, etc. I have been experimenting with the SqlTableProfileProvider, since this creates separate fields in a database table.  

However, when I am creating the profile and assign values to the profile using, e.g. Profile.FirstName it is setting my profile information, i.e. the current logged in user.

How do I add/update profile information for a user account?  The user will also update sectios of their profile, but the admin needs to be able to update all user profiles.

Thanks.
0
Comment
Question by:markerasmus
3 Comments
 
LVL 16

Expert Comment

by:kris_per
ID: 33700258

You can use ProfileBase.Create method to get the Profile of other users.

For e.g:

MyCustomProfile myProfile = (MyCustomProfile)ProfileBase.Create("username");
myProfile.ZipCode = "98052";
myProfile.Save();


msdn sample and documentation here => http://msdn.microsoft.com/en-us/library/ms151825.aspx

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33702360
What said kris_pe is correct you will need to create profile manually but here is an example which does same using CUW:
http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx

It uses ProfileCommane class:

ProfileCommon p = (ProfileCommon) ProfileCommon.Create(username);
p.FirstName="FirstName";
p.Save();
0
 

Accepted Solution

by:
markerasmus earned 0 total points
ID: 33726775
Because I am using SqlTableProfileProvider I ended up writing my own update queries to update the database table.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

22 Experts available now in Live!

Get 1:1 Help Now