Solved

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

Posted on 2010-09-17
3
836 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

10 Experts available now in Live!

Get 1:1 Help Now