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. Advertising

  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" wrote:

    > 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
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Siegfried Heintze
    Replies:
    0
    Views:
    2,257
    Siegfried Heintze
    Oct 24, 2005
  2. sloan
    Replies:
    5
    Views:
    1,497
    sloan
    Jun 4, 2006
  3. sloan
    Replies:
    1
    Views:
    497
    Chad Scharf
    Jul 3, 2007
  4. donet programmer
    Replies:
    3
    Views:
    1,517
    Gregory A. Beamer
    Nov 20, 2009
  5. Jason C
    Replies:
    4
    Views:
    670
    Morty Abzug
    Jun 26, 2012
Loading...

Share This Page