Create custom edit details page (User profile properties in MySite)
-
Tuesday, July 07, 2009 2:44 AMHi,I want to change edit details page of user profile property in MySite and add custom developed user controls, Does anyone know how to change edit details page of mysite.Regards,RK
Radhakrishna- Edited by Mike Walsh FIN Tuesday, July 07, 2009 8:26 AM in MySite added to Title
- Moved by Mike Walsh FIN Tuesday, July 07, 2009 8:26 AM MySite q (From:SharePoint - Development and Programming)
All Replies
-
Tuesday, July 07, 2009 8:26 AMAll MYSite questions go to Social Computing.
Moving this. (and amending the Title to include "MySite")
WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx -
Sunday, July 12, 2009 1:56 AM
HI
I got solution for my problem, I wrote HTTP module for handling the redirection on click of edit details link in my profile page and I redirected to my custom page that i had created.
Regards,
RK
Radhakrishna- Marked As Answer by RK Naik Sunday, July 12, 2009 1:56 AM
-
Friday, December 11, 2009 2:45 PMCan you send me the details on how you put together the HTTP module for redirection. I need to do the same exact thing as you have done.
Thanks. -
Friday, December 11, 2009 3:28 PMHi,
Below is the class for HTTP module redirection that I coded for HTTP module redirection
public
class EditProfileRedirection : IHttpModule
{
/// <summary>
/// The Page Load method
/// </summary>
public void Init(HttpApplication context)
{
context.PostAuthenticateRequest +=
new EventHandler(context_BeginRequest);
}
/// <summary>
/// The Dispose method
/// </summary>
public void Dispose() { }
/// <summary>
/// The Context BeginRequest method
/// </summary>
private void context_BeginRequest(object sender, EventArgs e)
{
try
{
string UserQueryString = string.Empty;
string editprofile = string.Empty;
HttpRequest request = ((HttpApplication)sender).Request;
HttpContext context = ((HttpApplication)sender).Context;
SPSite spSite =
null;
SPWeb web =
null;
if (SPContext.Current != null)
{
spSite = SPContext.Current.Site;
web = spSite.RootWeb;
SPUser currentSPUser = web.CurrentUser;
//Use this method too in case user is logged in as a 'masked' user (i.e.: SYstem acct)
String currentUserName = context.User.Identity.Name;
String[] currentUserNameSplit = currentUserName.Split(new char[] { '\\' });
String currentUserNoDomain = currentUserNameSplit[currentUserNameSplit.Length - 1];
//Don't redirect users running as system account this is one of our requirements.
if (currentSPUser.LoginName.ToLower() != "sharepoint\\system")
{
if (request.RawUrl.Contains("/_layouts/EditProfile.aspx"))
{
//URL of Previous page
SPSecurity.RunWithElevatedPrivileges(
delegate()
{
editprofile = ConfigurationManager.AppSettings[
"EditProfile"];
if (context.Request.UrlReferrer != null)
{
UserQueryString = context.Request.UrlReferrer.Query.ToString();
}
else
{
UserQueryString =
"?accountname=" + HttpUtility.UrlEncode(this.GetCurrentUserAccountName(currentSPUser));
}
context.Response.Redirect(editprofile + UserQueryString, false);
});
}
}
}
}
catch (Exception ex)
{
//Log ex to event viewer
}
}
/// <summary>
/// The Current User's AccountName Return Int Status
/// </summary>
string GetCurrentUserAccountName(SPUser CurrentUser)
{
//AccountName
SPSite spSite = SPContext.Current.Site;
ServerContext context = ServerContext.GetContext(spSite);
UserProfileManager upm =
new UserProfileManager(context);
UserProfile userProfile = upm.GetUserProfile(CurrentUser.LoginName);
//Write Code to add user profile property
Microsoft.Office.Server.UserProfiles.PropertyCollection properties = upm.Properties;
Property userprofileProperty = properties.GetPropertyByName(
"AccountName");
if (userProfile[userprofileProperty.Name].Value != null)
return userProfile[userprofileProperty.Name].Value.ToString();
else
return null;
}
}
add below lines to web.config
with HTTP modules
Radhakrishna -
Thursday, March 04, 2010 1:23 AMCould you send my you solution with source. I see you have pasted it below, but I'm having problems with it. Its also missing the web.config lines.my email is michael.denomme@hp.comthanks
-
Sunday, April 11, 2010 4:14 PMThank you Radha Krishna, using the PostAuthenticateRequest was what I needed to do.
-
Tuesday, August 07, 2012 12:16 PM
Dear RadhaKrishna,
Kindly send me the complete solution and web.config entries as well.
Regards,
Praveen Bisht

