Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to create the Profile object of user??

Reply
Thread Tools

How to create the Profile object of user??

 
 
Jeff
Guest
Posts: n/a
 
      10-13-2006
Hey

ASP.NET 2.0

I'm developing a web portal where users must login to. As far as I know all
users are accessible from the MembershipUserCollection. I know that current
user is also accessible via the Profile object in the webpage, but I want to
access the properties of one of the other users. So I guess I have to create
an instance of the ProfileCommon class... I have the username of the user I
want to create a ProfileCommon object of, but my problem is that I don't
know how to it....???



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FlZWQgS3VkYWltYXRp?=
Guest
Posts: n/a
 
      10-13-2006
You can use this code:
public List<MembershipUserWrapperForMP> GetMembers(string usernameToFind)
{

List<MembershipUserWrapperForMP> memberList = new
List<MembershipUserWrapperForMP>();

if (usernameToFind != null)
{
MembershipUser mu = Membership.GetUser(usernameToFind);
if (mu != null)
{
MembershipUserWrapperForMP md = new
MembershipUserWrapperForMP(mu);
ProfileCommon pc =
(ProfileCommon)ProfileBase.Create(mu.UserName, true);
md.FirstName = pc.FirstName;
md.LastName = pc.LastName;
memberList.Add(md);
}
}
return memberList;

}

"Jeff" wrote:

> Hey
>
> ASP.NET 2.0
>
> I'm developing a web portal where users must login to. As far as I know all
> users are accessible from the MembershipUserCollection. I know that current
> user is also accessible via the Profile object in the webpage, but I want to
> access the properties of one of the other users. So I guess I have to create
> an instance of the ProfileCommon class... I have the username of the user I
> want to create a ProfileCommon object of, but my problem is that I don't
> know how to it....???
>
>
>
>

 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      10-13-2006
Thanks for the tip!

This was about getting the profile of a different user, this code get the
profile of a different user:
ProfileCommon userProfile =
(ProfileCommon)System.Web.Profile.ProfileBase.Crea te("username", true);

I'm posting this reply in case somebody else came accross the same problem

Thanks for your tip Saeed


"Saeed Kudaimati" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> You can use this code:
> public List<MembershipUserWrapperForMP> GetMembers(string usernameToFind)
> {
>
> List<MembershipUserWrapperForMP> memberList = new
> List<MembershipUserWrapperForMP>();
>
> if (usernameToFind != null)
> {
> MembershipUser mu = Membership.GetUser(usernameToFind);
> if (mu != null)
> {
> MembershipUserWrapperForMP md = new
> MembershipUserWrapperForMP(mu);
> ProfileCommon pc =
> (ProfileCommon)ProfileBase.Create(mu.UserName, true);
> md.FirstName = pc.FirstName;
> md.LastName = pc.LastName;
> memberList.Add(md);
> }
> }
> return memberList;
>
> }
>
> "Jeff" wrote:
>
>> Hey
>>
>> ASP.NET 2.0
>>
>> I'm developing a web portal where users must login to. As far as I know
>> all
>> users are accessible from the MembershipUserCollection. I know that
>> current
>> user is also accessible via the Profile object in the webpage, but I want
>> to
>> access the properties of one of the other users. So I guess I have to
>> create
>> an instance of the ProfileCommon class... I have the username of the user
>> I
>> want to create a ProfileCommon object of, but my problem is that I don't
>> know how to it....???
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Visual Studio 2008 asp.net web administration>profile: "The profile wasn't created"? Andy B ASP .Net 0 05-03-2008 05:15 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Want to profile monitor for Fuji Frontier ICC profile? Lynn Digital Photography 9 09-08-2005 12:17 PM
Java Web Start app icons keep going in user profile not All Users profile Brad Java 1 07-19-2005 02:10 AM



Advertisments