Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-09-17
3
Medium Priority
?
874 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

705 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