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" 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. Advertisements

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. BS
    Replies:
    3
    Views:
    2,250
    Alvin Bruney [MVP]
    Jun 17, 2004
  2. Siegfried Heintze
    Replies:
    0
    Views:
    2,740
    Siegfried Heintze
    Oct 24, 2005
  3. sloan
    Replies:
    5
    Views:
    1,745
    sloan
    Jun 4, 2006
  4. Vai2000

    Membership Settings!

    Vai2000, Feb 5, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    408
    Alexey Smirnov
    Feb 6, 2007
  5. sloan
    Replies:
    1
    Views:
    681
    Chad Scharf
    Jul 3, 2007
  6. leeanne
    Replies:
    0
    Views:
    2,113
    leeanne
    Sep 24, 2008
  7. donet programmer
    Replies:
    3
    Views:
    2,064
    Gregory A. Beamer
    Nov 20, 2009
  8. Jason C
    Replies:
    4
    Views:
    904
    Morty Abzug
    Jun 26, 2012
Loading...