Profile Information of User

I have a static class and a static method within the class that I want to use to return the profile of a member. This is the method:

public static ProfileCommon GetProfile(MembershipUser usr)
       {
           ProfileCommon userProfile = null;
           userProfile = userProfile.GetProfile(usr.UserName);
           return userProfile;
       }

This is throwing an error so I am enquirying if there is an easier or better way of doing this?

Thanks
 

0
Niall20
1/19/2007 10:00:21 PM
asp.net.security 27051 articles. 1 followers. Follow

6 Replies
524 Views

Similar Articles

[PageSpeed] 21

You dont need an explicit function to define for GetProfile( ). It is already defined Method in Profile object.

just do like this:

ProfileCommon theuserProfile=Profile.GetProfile(userName);

for explained article read this:

http://www.dotnet-friends.com/Articles/ASP/ARTinASPb26f0c8a-a9f8-4176-8a1e-6c3f4ad185d5.aspx

Extra hint: to get MembershipUser use MembershipUserCollection object and then foreach statement to iterate on each user.

0
omerkamal
1/20/2007 1:43:20 AM

Ok, thanks for your help.

Regarding another error i am getting, i feel it may be related. The error is as follows:

Error    1    'Profile': member names cannot be the same as their enclosing type    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\XXX\62a108ed\961b60c2\App_Web_m1ixi7ax.10.cs  

It is occuring in App_Web_m1ixi7ax.10.cs which I cannot find.

Any idea what might be causing this?
 

 

0
Niall20
1/20/2007 3:41:17 PM

Are you using

ProfileCommon Profile=Profile.GetProfile(userName);

then change it like

ProfileCommon theuserProfile=Profile.GetProfile(userName);

Profile is a reserved keyword for Profile object.

To get the UserName you have to Iterate through "MembershipUserCollection" Object and then use "UserName" Property of the MembershipUser object.

This all will look like this:

MembershipUserCollection mc = Membership.GetAllUsers();

foreach (MembershipUser st in mc)
{

ProfileCommon userProfile=Profile.GetProfile(st.UserName); 

Label1.text=userProfile.Your_Defined_Profile_Field; //only for string types otherwise have to cast to string

}
 
0
omerkamal
1/21/2007 12:14:12 AM

Thanks for your help. The method I have is below:

  

public static ProfileCommon GetProfile(MembershipUser usr)
       {
           ProfileCommon theuserProfile = Profile.GetProfile(usr);

           return theuserProfile;
       }
 

The actual username is being passed into the method in a string so I am not worried about this.

However I know get the following error?

Has it anything to do with the fact that it is a static method in a static class?
 

0
Niall20
1/22/2007 12:25:56 PM
Niall20:

Thanks for your help. The method I have is below:

  

public static ProfileCommon GetProfile(MembershipUser usr)
{
ProfileCommon theuserProfile = Profile.GetProfile(usr);

return theuserProfile;
}
 

The actual username is being passed into the method in a string so I am not worried about this.

However I know get the following error?

Has it anything to do with the fact that it is a static method in a static class?
 

 

Forgot to include the error which is: The name 'Profile' does not exist in the current context  
 

0
Niall20
1/22/2007 12:29:04 PM
Ok I have this problem sorted but i am back to my original problem of

Error    1    'Profile': member names cannot be the same as their enclosing type    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\XXX\62a108ed\961b60c2\App_Web_m1ixi7ax.10.cs  

0
Niall20
1/22/2007 12:51:29 PM
Reply:

Similar Artilces:

Modify User Information / User Profile
I have been rooting around looking for the answer... with no luck... I want to modify the User Information / User Profile collected, for example delete MSN, AIM and Yahoo and add City, State and Zip. Where is this? Is it right in front of my nose? Thanks in advance, (again). The table in the DB is the Community_Users table. You will have to either extend this table, or create a new table using a foreign key relationship to the users table to hold your new fields. You probably don't need to mod any stored proc though since the profile procedures use select * (bad design, but ...

How to store user profile information during create user?
Hi, I'm just try to store user information during create user via CreateUserWizard that add Textbox, DropDownList and RadoButtonList. How to store data form control to UserProfile (via CreateUserWizard) ? Note. I set DisableCreatedUser = true because want to proof user befor activate. (Begining ASP.net V2.0, VB, VWD 2005 Express Edition) Here is some example c# code that I have in the CreateUser event of the CreateWizard command.  I also do some stuff after this but I think this is the code you are interested in.     protected void CreateUserWizard1_CreatedUser(objec...

How can I carry anonymous users profile information to authenticated user
HelloI can carry the anonymous users profile information like favourite team name etc but when the user logs in how can I  carry the profile knowledge to the authenticated users profile.Good Nights Please provide some more information about the hangup. At least I couldn't understand what exactly are you trying to achieve. So simple... yet so effective.My "Life"ly Blog You need to add the Profile_MigrateAnonymous event in your global.asax. Here's a sample: void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e) { //Migrate Profile Profil...

User Profile Information
I'm trying to figure out a best method for keeping track of certain profile information about a user that has a membership profile (username, password, etc.).  In particular the user is associated with a customerID that I use quite ofter in the querying of data.  Any suggestions on the best way to keep this information handy?  In the past I would keep it part of the session for the user, but now with the provider model and the personalization stuff I thought there might be a better way.Your comments are appreciated.Tyler here is a sample of part of one of my stat...

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 Profile Information
Just a quick question - I have been asked to build a games community portal for my current employer. User information is to include gaming platforms, basic contact information etc...Normally I just create a sql database table to hold all this info - I was thinking along the lines of (see below), my question is: is this the best way to store the data, or use the .net profile system.Any pointers would be really helpful. ThanksDave /* Create Table: dbo.Contact*/PRINT N'Table Created: dbo.Contact'GOIF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = N'Contact' AND TYPE = 'U&...

SQLGrid User Profile information?
I'm trying to use the excellent SQLGridSelectedView to show a view of the User's profile, but am not sure how to access the 'City' data. Everything works accept for that. Any help?select users.username AS 'User Name', users.firstname AS 'First Name', users.lastname AS 'Last Name', roles.rolename AS 'Role', aspnet_membership.email AS 'Email', aspnet_Profile.City from users inner join aspnet_ProfileON users.userId = aspnet_Profile.UserId inner join userroles on users.userid = userroles.userid inner join roles on userroles.roleid = roles.roleid inner join aspnet_users on users.username = a...

Modify user profile information
Hi,I would like to modify the user profile information in the CSK and am struggling with how it all hangs together. Does somone have a step by step instruction for how to for example remove the ICQ field from the registration form ? I understand the database and stored procedures tasks, but need to understand the steps involved in changing the forms.Many thanksNiclas the plact to start would be in the solution explorer in visual studio go to comunitystarterkit/engine/framework/users/from there it sounds like you need to remove what you dont want from the following  .../components/prof...

Access profile information for a user
Hi - I am using .net2/VB, and have a party booking system. I store some additional info (address, postcode, fullname etc) in the Profile object for each user, so I can access it as the logged in user from code, such as tbAddress.text = profile.Address. If I log in with an admin type account, can I access the profile information for a specific user? eg. is there something like: Dim userprofile As ProfileUser = Profile.GetProfile(username) tbAddress.text = userprofile.Address Thanks for any help, Mark Try below code Dim user As MembershipUser = Membership.GetUser(username)Dim use...

Extracting User Profile Information
This may seem real stupid....has anyone created any mods that help with extracting certain or all user profile information out from CSK as controls to say a text file? Minesh...

Modifying user profile information
Hi,Does anyone have a step by step instruction for how to modify the user profile information. I would like to add some fields and remove some of the default (using DNN 3.1.1). Would like to understand what files and database fields requires to be updated.Many thanksNiclas  In the current implementation this would require you changing the info object, controller classes, along with the web.config and the register.ascx.  You could also write your own profile provider but that is no small task. Chris Paterra I believe that there is a thread going in the main DNN forum ...

could we add information to the User Profile ... ?
Hello, I'm developping a site with the Community Starter Kit, it is very usefull ! I just miss that we can't find the Birthday of a user in the current form. So I'd like to add this information for each user ... Is it possible ? because we don't have any access to the register form, don't we ? I was thinking of creating my own form and had these additionnal informations by my own, and store them in Community_Users table ... do you think it is possible and a good way ? is there any simple solution ? thanks a lot It should be rather simple to do this, though there are chang...

List of all users and their profile information
Hi there,Can anybody help me to get list of all users and their profile information ?Thanks a lot. ...

Creating addition profile information for users.
So here is my current issue.I have a user register on the register page in the root directory.  This is done with the create user wizard.  It works fine and creates ApplicationId, UserId, UserName, ect... in the aspnet_Users (dbo).  Then the user can edit / view their profile via the included attached pages that sit in the protected member directory.  This also works (somewhat).The problem is that the asp.net profile provider blobs the fields together in the aspnet_Profile(dbo) table.By doing this I can't query or run stored procedures against the database which is a ...

Web resources about - Profile Information of User - asp.net.security

Information - Wikipedia, the free encyclopedia
Information (shortened as info or info. ) is that which informs, i.e. an answer to a question, as well as that from which knowledge and data ...

InformationWeek – Latest Information Technology (IT) news & IT articles - Technology news - IT magazine ...
InformationWeek provides latest Information technology (IT) news online & articles and publishes latest tech news & IT magazine for Indian IT ...

US gave San Bernardino shooter Tashfeen Malik visa 'despite missing information'
A congressman claims the US approved an entry visa even though Malik never provided the extra evidence requested by an immigration official. ...

Trudeau says improving access to information will make government better
Ensuring Canadians have access to federal information will mean more and sometimes difficult public scrutiny, but ultimately it will lead to ...

Making Access To Information Better Will Make Improve Government, Trudeau Says 54
The Liberals will conduct a "proper review" of the decades-old Access to Information Act with the aim of figuring out "what is actually going ...

Martin Peers Promoted at The Information
The Information, the tech subscription site that was founded in 2013, has named Martin Peers managing editor. Peers most recently served as ...

Senate Intellicence Committee Chair Burr all but confirms that Cruz leaked classified information at ...
... that, among other things, updates the government’s program of collecting phone metadata. In doing so, Cruz probably leaked classified information. ...

It's not exactly the Watergate break-in — is it? — but Bernie Sanders's campaign broke into Hillary Clinton's ...
... Democratic National Committee have accused the presidential campaign of Sen. Bernie Sanders of improperly accessing confidential voter information ...

U.S. Gave Malik Visa Despite Missing Information, Lawmaker Says
Bloomberg U.S. Gave Malik Visa Despite Missing Information, Lawmaker Says Bloomberg The U.S. approved an entry visa for Tashfeen Malik, one ...

Did Ted Cruz release classified information during Republican debate?
Senate Intelligence Committee chair Sen. Richard Burr asked his staff to check on something Cruz said during the fifth GOP debate Tuesday night ...

Resources last updated: 12/26/2015 8:47:54 AM