Article Index

ProfileView

ProfileView

This is the official home of my new ProfileView control. ProfileView is an ASP.NET 2.0 server control that enables your users to view and/or edit their Personalization Profile. Read my original post about it for more background.

Download

The source code is now freely available! Download it and do with it as you wish. If you add any features, I would appreciate it if let me know about it using the contact information on my blog.

Download the binary

Download the source code

How to use

Register the assembly at the top of the aspx page that will host the control:

<%@ Register Assembly="FlimFlan.WebControls" Namespace="FlimFlan.WebControls" TagPrefix="flim" %>

Place the control markup where you want the ProfileView to appear:

<flim:ProfileView ID="UserProfile" runat="server" />

History

June 24, 2006: Release 1.2.524.2006

January 8, 2006: Release 1.1.108.2006

October 30, 2005: Updated for the final release (RTM) version of Visual Studio 2005 / .NET Framework 2.0

July 7, 2004: A significantly updated version is now available.

TODO:

Comments

Has anyone figured out how to retrieve profile data without updating the LastActivityDate? This has been a big headache for me and is keeping me from using profiles to store data.
Bryan Peters - January 09, 2006 07:07am
I can think of 2 possible solutions:

1) Create your own profile provider - you can make it do whatever you want. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNETProvMod_Prt5.asp

2) Modify the stored procedure created by the SqlRoleProvider. It looks like the one you want to modify is called aspnet_Profile_GetProperties (in your provider database - aspnetdb by default). The last statement in that procedure updates the LastActivityDate. Remove it (or comment it out).
Joshua Flanagan - January 09, 2006 07:35pm
Thanks Joshua! I think modifying the stored procedure is my fix for this.
Bryan Peters - January 11, 2006 05:48am
Hi,

I'm trying to download the newest release, but the .zip contain an older version: 1.0.1030.2005

I realy need the new features :)

One more thing.
How can I use this control in an admin page? I want my site admins to be able to change the users profile info.
Zoltan - March 01, 2006 08:46am
Zoltan -
You've stumbled upon something strange. When I download the release using Firefox, I *also* get the old version. I have checked and re-checked, uploading the new version many times, and I still get the old version. I then tried using IE, and it downloaded the correct new version. I have no idea why at this point, but its something to try.

Sorry, you cannot use it in an admin page to manage other user's profiles. My control is built on Microsoft's Profile Provider framework, and that framework wasn't designed for the use case of manipulating other people's profiles.
Joshua Flanagan - March 03, 2006 04:36pm
Great job on this! Especially the latest release being able to edit other profiles as an admin. Question - assuming the control is just dropped onto a page in design time and I want to select users from a separate list box and then update it, I currently need to click Reset. I tried but could find no way to reset the form other than clicking that button. Any thoughts on how I would accomplsh that?
Karl Wilkens - October 04, 2006 10:01am
Hi Joshua,
I am still learning asp.net and I am haour instruction having trouble implementing the profileView. Can you give me more detail about how to use it. I followed your instruction above but I got the following error message in the control: "error creatin control- conent1 unknow server tag 'flim:profileView' "

As a learning project, I trying to create a dating website where user will create their profile and a profile of their match. So all site visitors will be able to search for soulmate base on location, gender, age, sexual orientation, ect....
What is the best way to implement such a project?
Thank for your help and caoching!
Moussa
Moussa - December 12, 2006 11:32am
Is the built in membership/login controls good for a website with thousands of visitors? Or is using the profile to 'chatty' with the database as I have read at other websites? I like your control by the way. Thanks for sharing.
Jeff - December 14, 2006 02:51pm
Jeff - The membership/login controls are independent of the profile controls. You can use one without the other. I do not know if the default providers are too chatty for a high traffic website, but the beauty of the provider model is that you can optimize the behind-the-scenes database interaction for your use, while still using the same UI controls (like the Login, and ProfileView). You can fully develop your website using the built-in local SQL Express database providers, and then swap them out for highly optimized providers when needed. Your web.config will change, but none of the rest of your code should have to.
There is now a lot of documentation (including full source code of the Microsoft providers) on how to create your own provider. Check out Scott Guthrie's post:
http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx
Joshua Flanagan - December 14, 2006 07:53pm
Hi i like it thanks for taking your time to create it.
briiin - January 14, 2007 10:32pm
Hi Joshua,

I have heard great things about ProfileView, but I am new to Visual Studio and I'm not sure how to use the source code. Could you give me just a brief explanation about how to implement it? Many thanks in advance.

Fred
Fred Pinter - January 29, 2007 07:31am
Hi,

I really appreciate you great help if you could kindly have a look at the below scenario and provide your feed back. thankyou.

I have a web site in which, I would like to create or have a table (with add/remove option)in each/every profile, & one column of that table should be dropdown (where he should be able to select the server name)& rest of the columns he can able to write/fill.

please do kinldy help me. Thanks again,
Rasheed - January 30, 2007 02:44am
hai


i am doing project in asp dot net. i had a doubt that is how to set they dropdownlist size when you add more items

i was add 100 items if i click the dropdownlist the size is increase. i want display 10 items, other items view through scrollbar

reply me
velu - February 21, 2007 09:19pm
Downloaded this, the binary version works well only the formatting does not allow for freedom and I needed to have some profile properties disabled so that I could use a drop down instead.

Anyway, I was trying to play with the source code but it does not open with VS.2003 and also not with C# Express 2005
Emilio - March 28, 2007 11:14am
Profiles were not available in .NET 1.1, so Visual Studio 2003 will not work.
C# Express does not support class libraries, so it will not work either. You need a full version of Visual Studio 2005. You could probably also use MSBuild.exe, CSC.exe, or SharpDevelop to compile the code.
Joshua Flanagan - March 28, 2007 07:55pm
Actually I got it to compile in Express C# 2005 just fine. Altered the source to add a property so that one can select rendering type (DIV/Table) although DIV seems to be the best.

The problem I found using it in an admin page is that when you change the name of the user nothing happens. Further investigation revealed that when the Username property of the control is set it only updates the private member field but it does not bother to update the controls with the values of the properties of the selected user :O

Haven't yet figured out how to get it done without breaking the rest.
Emilio - April 14, 2007 06:46am
RE: Has anyone figured out how to retrieve profile data without updating the LastActivityDate? This has been a big headache for me and is keeping me from using profiles to store data.


When you call GetProfile, there is a second param (bool) you can set that will force it to NOT update.
Stephen Gutknecht - August 05, 2007 12:12pm
Joshua

I want to use your control but have only one isue with it and do not have enough knowledge to modify your source code.

My Problem as follows:
I have Profile Properties defined in web.config as below - :
<add name="Country" type="string"/>
<add name="Gender" type="string"/>
<add name="Age" type="Int32"/>
<add name="DateOfBirth" type="DateTime"/>

When viewing the page containing your control thru the browser, only the COUNTRY and GENDER properties is available to be edited. Is there any reaon why the other two is not available. Might it have something to do with their TYPE?

Thanks in advance.

Cheers,
Johan
Johan Van Dyk - November 14, 2007 08:45pm
Johan - Try setting the types to System.Int32 and System.DateTime, respectively.
Joshua Flanagan - November 15, 2007 04:31pm
Hi Joshua

Thanks for your quick response. That did the trick. Is there any easy way of setting the properties for the individual fields, i.e. width of textboxes, validation etc.

Cheers,
Johan
Johan Van Dyk - November 16, 2007 08:26am
Great control Josh - A quick question:

It would seem very common to be able to set a "display name" for profile properties. Is there any easy way to do this?

For example I might have a property called SpecialOffer, and the code should use that name, yet the HTML display might be "Free ECards".

Otherwise the UI could not be changed independent of the code, right?

Any feedback appreciated -
LTG
LTG - December 29, 2007 01:24pm
how can i get profile for defined username by your control?
shahbaz tavackoli - March 15, 2008 02:48am
hi

i downloaded the .zip file.

But i could not find .aspx file on it.

how do i make this application run?

thanks.
jack - March 30, 2008 03:54am
Jack - ProfileView is not an application, it is just a WebControl that you can use in your own application.
Joshua Flanagan - March 30, 2008 07:34am
I was struggling with the problem of updating last activity date for quite a time. I'm really lucky of finding this blog after lots of digging in code and various blogs on the web.

So, what is the final solution to avoid updates of the last activity date? My code looks like this:

private MembershipUserCollection GetSiteUsers()
{
MembershipUserCollection siteMembers = new MembershipUserCollection();
MembershipUserCollection Members = Membership.GetAllUsers();

foreach (MembershipUser CurrUser in Members)
{
if (Profile.GetProfile(CurrUser.UserName).SiteID == Profile.SiteID &&
!Roles.IsUserInRole(CurrUser.UserName, "MasterAdmin"))
{
siteMembers.Add(CurrUser);
}
}
return siteMembers;
}
Naomi - April 14, 2008 09:32am
Naomi - I'm not sure what you mean by "final solution". I proposed two possible solutions in the comments above. You will need to decide which is the best for your situation.
Joshua Flanagan - April 14, 2008 05:02pm
I don't see the second parameter in GetProfile method
Naomi - April 17, 2008 10:51am
How about a screenshot of it in a working environment, so we can quickly see if this is something we would like to implement... or not. Gracias!
ben - May 07, 2008 03:20pm
Is this compatible with the table profile provider? Anyone tried it?
(http://www.asp.net/downloads/sandbox/table-profile-provider-samples/)
Sam - July 15, 2008 09:52am
Sam, the ProfileView control is built on top of the exposed Profile API, so it should work regardless of the provider implementation you are using.
Joshua Flanagan - July 15, 2008 03:26pm
Hi Josh,

this control was very helpful. I have one issue, once the form is working and a user fills it out, how do you get it to move to a new page. Is there a way to make this another step in the create account wizard?
Brian Graffius - August 19, 2008 10:44am
This control looks like exactly what I need. I'm having some trouble getting the control to load a different user's profile, however, even though it looks like you've added that functionality from the update log. I set {control}.username = "MUser" and call to {control}.databind but it still shows the currently logged in user. Am I missing something simple?

Thanks,

Doug
Doug - September 02, 2008 03:17pm