Accessing user profile properties for every user of the system, not just he/she whom is logged in.

Okay,

on application_start i have to refresh the roles and users of a system.  one of the roles is basically created to contain every user who resides inside an active directory group.  Creating the users like this is fine but what i also need to do is have a custom profile property (which has been defined in the web.config) and make that equal to the givenName property of the DirectoryEntry object i got back from AD.

Question is, how do i get access to that property?

to clarify, what i'm essentially trying to do is this-

 

if (username != null && !Roles.IsUserInRole(username,RoleNames.usersRoleName))

{
    Roles.AddUserToRole(username,RoleNames.usersRoleName);

    Profiles.SetProperty(username, "firstName", DirectoryEntry.Properties["givenName"].ToString()); //blatantly pseudocode           
}
 
0
stimul8d
9/26/2007 12:10:58 PM
asp.net.personalization 3779 articles. 0 followers. Follow

2 Replies
185 Views

Similar Articles

[PageSpeed] 17

You can write a loop like this:

MembershipUserCollection muc = Membership.GetAllUsers();
foreach (MembershipUser mu in muc)
{
if ((returnAllApprovedUsers==true && mu.IsApproved==true) ||
(returnAllNotApprovedUsers==true && mu.IsApproved==false))
{
MembershipUserWrapperForMP md =
  new MembershipUserWrapperForMP(mu);
ProfileCommon pc = (ProfileCommon)ProfileBase.Create
  (mu.UserName, true);
md.FirstName = pc.FirstName;
md.LastName = pc.LastName;
md.AdvancedMode = pc.AdvancedMode;
md.Address_Street = pc.Address.Street;
md.Address_City = pc.Address.City;
md.Address_State = pc.Address.State;
md.Address_Zip = pc.Address.Zip;
memberList.Add(md);
}
}

check out my full blog post (also msdn article)  at: http://peterkellner.net/2006/03/13/adding-personalization-via-profiles-to-the-objectdatasource-in-aspnet-20/

 


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
9/26/2007 2:05:10 PM

Thanks, that pointed me in the right direction at least. 

0
stimul8d
9/27/2007 2:29:33 PM
Reply:

Similar Artilces:

Accessing Profile of users other than current user.
I want to access profile of other users. I want to allow my members to visit other members profile. I am not going to disply the senstive information. The default sql profile provider access to profile of current user only. Hi you need to use the getProfile function as follows:ProfileCommon UserProfile = Profile.GetProfile(UserName); UserProfile.PropertyName1=....   Please read this related thread : http://forums.asp.net/p/1243638/2279740.aspx   Regards,Regards,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wron...

How to determine user role
Please advice.  I know that for logged in user the way to determine if he is in role is: user.isinrole("role1") But I have a task to display the role of another user, I have its UserName as an input. How do I do it?  And linked question: Why user.isinrole("role1") doesnt work in UserControls? Says "Name 'user' is not declared".    Roles.IsUserInRole("username","rolename")--Harder Better Faster Stronger - My BlogSalvo Davide Rapisarda...

User logs in, loads another users profile.
I hope i'm posting in the correct place, I'm not sure if this is an AD issue or a Novell client issue, or ConsoleOne. User A logs into windows XP with the correct user name and password, it logs him in but loads User B's profile. Both users have never logged into the computer so it's not loading a cached profile, it always loads users B's profile, doesn't matter which computer. If user B logs in it is fine. I checked both users profiles in AD and ConsoleOne and all seems to be set correctly. We do not use roaming profiles, nor do we use terminal se...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

Users logging in as the same user..
HI there.. I have a problem with ASE12.0 .. I have created 10 users on the database and granted everybody permissions and all.. However, it seems everybody, no matter who logs in, logs in as the same user.. For eg... I have user logins John, Alex, Alan, Steve......etc etc And i created a user group for all of them (eg developers..) However, when they log on to isql, anything that they do will be under John, no matter if it is logins John, Alex, Steve... or etc etc.. If i do a sp_who.. all the connections will be listed as John. If they create tables, all table created will ...

how do I reteive the profile of a specific user that is not the current logged in user?
I am trying to retreive the profile for a specific user without that user being the current logged in user. I am in a class module and I have tried that but did not work:Dim UserGenProfile As ProfileInfo Dim reccount As IntegerUserGenProfile = ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption.Authenticated, UserName, 0, 1, reccount).Item(0)   Hi Try to implemnt this piece of code ProfileCommon profile = Profile.GetProfile("MyUserName"); string name = profile.Name;Avantha SiriwardanaBeware of bugs in the above code; I have only proved it correct, not...

Accessing properties of user control inside user control
I have a simple MemberPhoto user control which has a photo of a member along with username and if they are online.I would like to reuse this control inside of another user control (MemberSummary) that would include the member's photo and some basic information about the member.  I would like to know what is the "Best Practice" to set/read properties on the member photo control from a web form.1. Should the MemberSummary define a property that returns the MemberPhoto user control and there I would have access to th...

Single Users Profile and All Users Profiles List
I've made a discussion forum. And I have also installed simply asp.net membership. Now I want after click on user link to redirect to the page with User's info.I have simply user "John" and user "Bob" and everyone can click on those names and will see page with informations stored in Profile (Like Profile.Name, Profile.Address). I have three simply question:1. How to show profile values of other User ? Like I wrote above.2. How to list all users with for example their e-mails ? I mean: UserLogin - UserName - UserMail3. Or the easier way is to make new table with those all information an...

User Control A needs to access a User Control B property
Greetings, I have a situation where one user control (A) needs to access a property that is exposed by another user control (B) on the same page.  I would like for user control A to access B's property directly and not have the parent page involved. How can this be done? Thanks, BCB try this using System.Web.UI.UserControl; public class A : System.Web.UI.UserControl {        private void Page_Load(object sender, System.EventArgs e)        {        &nb...

How update or modify all users profile properties in one authenticated user!
How update or modify all users profile properties in one authenticated user!   Are you looking for a way to load the profile data for a user based on just their username, and then save the updated data back to the database?  If so you use code like: ProfileCommon p = Profile.GetProfile("some user name here");p.SomePropertyValue = "new value";p.Save();-Stefan----------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no rights....

viewing profile properties for a logged in user
Once, a user logged in he can view or edit his profile properties. I cant understand how this can be done. its not allowed to edit ASPNET tables. i need to connect the aspnet_profile table and the aspnet_membership table to do this!!! plz can u help me solve this?? osama  Osama Mansour Hi Osama, Check out this sample code which should give you an understanding about how information can be saved in and out of user profile: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Profile.FirstName = txtFirstName.Tex...

Login Control logs user in, but User is not authenticated, but user really is!
I am using aspnetmembershipprovider.  Everything works fine.  I slap a login control on my login page and am able to login and get to my secure folder etc.  When I try and put some code in the LoggedIn method "User.Identity.IsAuthenticated" = false, yet if I blow through that, I am logged, authenicated etc.  The documentation says that the LoggedIn event is "after the user is authenticated".  Any Ideas what is up?Thanks,TPS------------------------------------------------------Note Collaboration for your next confernce call.http://www.ConferenceCallNotes.com I am...

Setting Profile Properties for user thats not logged in?
 Hi, Is it possible to set Profile properties of a user that is not currently logged in?  If so, how? I have an adminUser that can create new user accounts.  I want this user to be able to set other user's Profile properties. thanks You should be able to access the Profile properties to both read and write them for a user by assesing the ProfileCommon object that you can get by calling GetProfile(...). Code could look like this:  ProfileCommon profile = Profile.GetProfile(username); profile.TheProperty = "A New Value"; profile.Save();&n...

The Profile properties are gone everytime the user logs off
Hi guys, I want to use profile properties to store some user information, but everytime the user logs off the information is lost.My profile section looks like that: 1 <profile defaultProvider="AspNetSqlMembershipProvider">2 <providers>3 <clear/>4 <add name="AspNetSqlMembershipProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ConnectionString" applicationName="/Vodiweb"/>5 </providers>6 <properties>7 <add name="clientID" type=&q...

Web resources about - Accessing user profile properties for every user of the system, not just he/she whom is logged in. - asp.net.personalization

Properties of water - Wikipedia, the free encyclopedia
This article is about the physical and chemical properties of pure water. For general discussion and its distribution and importance in life, ...

Facebook Surpasses All Google Properties In Brazil
Facebook overtook Orkut to became Brazil’s top social network in January, but has only overtaken all of Google’s properties in that nation just ...

Extended Profile Properties - Facebook-Entwickler
These Permissions cannot be revoked in the Login Dialog during the login flow, meaning they are non-optional for Users when logging into your ...

PortPerry Properties (@brian14mckinlay) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Hawaii Real Estate Properties on the App Store on iTunes
Get Hawaii Real Estate Properties on the App Store. See screenshots and ratings, and read customer reviews.

Qld climate change pilot study shows 4400 properties could flood in Townsville
The Queensland Government is silently preparing Queensland for an 80cm sea rise, which would impact tens of thousands of homes by the end of ...

Properties pass in as 1000 auctions unfold after last week’s Melbourne Cup lull
Melbourne's declining real estate clearance rate was reflected by mixed auction results on Saturday.

Golden Mile a 'basketcase' as commercial properties lose value
Kings Cross will never again function as Sydney's late-night entertainment precinct, property owners say, with residential developers snapping ...

Nobody's home: Housing boom leaves swathe of empty properties
The nation's three-year property boom is leaving its biggest cities awash with empty homes, a report shows.

Queensland storms: Roofs ripped off houses in Warwick, 19,000 properties left without power
... roofs in Warwick, as wild storms move across south-east Queensland. More than a dozen homes have lost their roofs and close to 19,000 properties ...

Resources last updated: 12/17/2015 4:00:48 PM