I am using ASP.NET membership for the authentication of my web app. This worked great for me. I now have to implement password expiration.
If the password has expired th
Further to Andrew's answer, I found you need to check that the user is not already on the change password page, or they will never be able to actually change their password, and hence never leave the change password site:
void Application_PostAuthenticateRequest(object sender, EventArgs e)
{
if (this.User.Identity.IsAuthenticated)
{
// get user
MembershipUser user = Membership.GetUser();
// has their password expired?
if (user != null
&& user.LastPasswordChangedDate.AddMinutes(30) < DateTime.Now
&& !Request.Path.EndsWith("/Account/ChangePassword.aspx"))
{
Server.Transfer("~/Account/ChangePassword.aspx");
}
}
}