Solved

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

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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

635 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