Add password reset page in Form Based Authentication MOSS 2007 site:Overview:This article explains how to add a reset password page in Form Based Authentication enable SharePoint 2007 (MOSS) site, so the user can reset his/her password. We will add this page in standard menu.
Problem:When you enable forms authentication on SharePoint 2007 (MOSS), it means that users credentials are stored in membership database like ASP.NET database. In Form Based Authentication site, if we want to reset password then reset password page should be accessible to anonymous user also.
Solution:We are going to add new feature (ResetPasswordPage feature) in the standard user menu:
1. Write code .cs file(c# file), In this class, we will inherit the class Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase
For example:
public class ExtranetPasswordReset_Test : Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase
2. Creating ExtranetPasswordReset_Test.aspx
3. Creating ResetPasswordPage feature
4. Deployment
1. Creation of ExtranetPasswordReset_Test.aspx:We will create new ExtranetPasswordReset.aspx with the help of VS 2005.
<%@ Assembly Name="Microsoft.SharePoint,Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" Inherits="Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase" MasterPageFile="~/_layouts/simple.master" %>
<%@ Assembly Name="Test.Security, Version=3.0.0.0, Culture=neutral, PublicKeyToken=8b7a42e9b9b5355f" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
Site Title:
Code behind file of ExtranetPasswordReset_Test.aspx, called ExtranetPasswordReset_Test.aspx.cs:
1. We need add two functions:
I. protected override bool AllowAnonymousAccess
II. protected void Page_Load(object sender, EventArgs e)
2. Inherit the class with UnsecuredLayoutsPageBase class.
namespace Test.Security.Web.UI
{
public class ExtranetPasswordReset_Test : Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase
{
protected override bool AllowAnonymousAccess
{
get
{
return true;
}
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Test");
}
}
}
2. Create ResetPasswordPage feature:We will create Feature file and put into the ResetPasswordPage folder inside the Feature folder.
We also need to create elements.xml file.
Set CustomAction properties as shown, Location to be ‘StandardMenu’ and UrlAction URL property should be “_layouts/ExtranetPasswordReset_Test.aspx”
3. Deployment
1. Copy ‘ExtranetPasswordReset_Test.aspx’ file to the following path:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\
2. Copy ResetPasswordPage folder that contains elements.xml and feature.xml to the following path: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\
3. run the following command:
Now the feature is installed successfully, but needs to be activated.
4. Go to your site-> Site Actions -> Site Settings -> Modify All Site Settings->Site Collection Features ->Activate ResetPasswordPage feature.
Now you can find Reset Password action in the standard user menu
Comments