Losing Membership Provider Settings

Discussion in 'ASP .Net Security' started by Brett Ossman, Apr 28, 2009.

  1. Brett Ossman

    Brett Ossman Guest

    I have a simple sample app that offers a ChangePassword.Aspx page. If I
    click a link to that page, all my membership provider settings work fine, but
    if I Response.Redirect to that same page, seems the app totally loses track
    of any of my provider settings, such as my passwordStrengthRegularExpression.


    For example:

    This loads ChangePassword.Aspx and all membership provider settings work:
    <asp:HyperLink ID="HyperLink3" runat="server"
    NavigateUrl="~/MemberPages/ChangePassword.aspx">Change
    Password</asp:HyperLink>

    However, the following loads ChangePassword.Aspx when it should, but it
    seems to lose track of my provider settings such as my regular expression.
    Any attempt to enter a new password fails:

    If Membership.ValidateUser(Login1.UserName.ToString, Login1.Password) Then
    ' Check for a first-time login
    If mu.LastPasswordChangedDate = mu.CreationDate Then
    Response.Redirect("~/MemberPages/ChangePassword.Aspx?
    Reason=FirstLogin")
    Else
    FormsAuthentication.RedirectFromLoginPage
    (Login1.UserName, Login1.RememberMeSet)
    End If
    End If

    FYI, the RedirectFromLoginPage work fine also.

    Any ideas? I can get into more detail if need be, but thought this might be
    enough.

    Thanks
    Brett Ossman
     
    Brett Ossman, Apr 28, 2009
    #1
    1. Advertisements

  2. Brett Ossman

    Brett Ossman Guest

    Nevermind, I figured it out. :)
    I applied my redirect logic to the LoggedIn event instead and all works well.
     
    Brett Ossman, Apr 28, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.