One of my clients wanted to have the user profile on SharePoint to be redirected to a custom page that they have created showing the user's picture and other detailed information that would not basically appear on the out of the box user details page.

With this task in hand I have to explain the mechanism behind user profiles details page. When a user is clicked on SharePoint, userdisp.aspx page is called which determines the destination of the page. This page can ge found at 12hive\Templates\Layouts.

To allow the details page to be directed somewhere else, add the following code to your userdisp.aspx

<%@ Assembly Name="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Then just before the closer of your content tag </asp:content> add the following code

<%
// Changes to redirect User Display to Details pageas per the requirements
try

Microsoft.Office.Server.ServerContext cntx =   Microsoft.Office.Server.ServerContext.GetContext(HttpContext.Current);
Microsoft.Office.Server.UserProfiles.UserProfileManager profileManager = new Microsoft.Office.Server.UserProfiles.UserProfileManager(cntx);
bool userExists = profileManager.UserExists(this.UserListForm.Item["Account"].ToString());

if (userExists)
{

// to redirect to a custom page
Response.Redirect("/<your custom page url>.aspx?=accountname:" + this.UserListForm.Item["Account"].ToString

// to redirect to my site page
Response.Redirect(profileManager.MySiteHostUrl + "/Person.aspx?accountname=" + this.UserListForm.Item["Account"].ToString());

());
}  

}    

catch

{
// do nothing, will use the original userdisp.aspx
}

%>

Hopefully this helps someone!