This project is read-only.

CKS:FBA - Fix for Change Password link on AD sites

Topics: General/Misc., Internet/Extranet Edition
Apr 21, 2009 at 5:37 PM
The current FBAChangePasswordPage feature uses a custom action to add a Change Password link to the StandardMenu/PersonalActions section.  Only problem is, this link appears both on the AD and Forms Based Auth sites, when it only makes sense on the FBA site.

The following change will fix this:

Elements file:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="">
    Title="Change Password"
    ControlAssembly="CKS.FormsBasedAuthentication, Version=, Culture=neutral, PublicKeyToken=d0c9b215512a2c5d"

New code class, ChangePasswordLink.cs:

using System;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace CKS.FormsBasedAuthentication
public class ChangePasswordLink : WebControl
/// <summary>
/// Handles the <see cref="E:System.Web.UI.Control.Load"/> event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnLoad(EventArgs e)

/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
if (this.ChildControlsCreated)

//bail if not using Forms Authentication
if (SPSecurity.AuthenticationMode != System.Web.Configuration.AuthenticationMode.Forms)


//Create the Change Password link
MenuItemTemplate changePasswordMenuItem = new MenuItemTemplate("Change Password");
changePasswordMenuItem.Description = "Change your current password.";
changePasswordMenuItem.ClientOnClickNavigateUrl = "/_layouts/fba/ChangePassword.aspx";
changePasswordMenuItem.Sequence = 1;