Link to home
Start Free TrialLog in
Avatar of Robert Treadwell
Robert TreadwellFlag for United States of America

asked on

ReturnUrl Duplicate Parameters

After session times out it returns to login page with the returnurl parameters.  The parameters reference the path, filename and two references of the userID.  Not sure why the userID 'id=316' is referred to twice.

Partial link listed below.
/Login.aspx?ReturnUrl=%2fForms%2fCRE4.aspx%3fid%3d316&id=316

vbCode:
 Protected Sub onAuthenticatedEvent(ByVal sender As Object, ByVal e As AuthenticateEventArgs)

        Dim userNameTB As TextBox = CType(LoginView1.FindControl("ADCLogin").FindControl("UserName"), TextBox)
        Dim passwordTB As TextBox = CType(LoginView1.FindControl("ADCLogin").FindControl("Password"), TextBox)
        Dim rememberUserName As CheckBox = CType(LoginView1.FindControl("ADCLogin").FindControl("RememberMe"), CheckBox)
        Try
            If Membership.ValidateUser(userNameTB.Text, passwordTB.Text) Then
                e.Authenticated = True
                FormsAuthentication.SetAuthCookie(userNameTB.Text, False)
                Session.RemoveAll()
                Session("authUserName") = userNameTB.Text
                Dim userRoles As Array = Roles.GetRolesForUser(userNameTB.Text)
                Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _
                  userNameTB.Text, _
                  DateTime.Now, _
                  DateTime.Now.AddMinutes(20), _
                  rememberUserName.Checked, _
                  userRoles(0), _
                  FormsAuthentication.FormsCookiePath)

                ' Encrypt the ticket.
                Dim encTicket As String = FormsAuthentication.Encrypt(ticket)

                ' Create the cookie.
                Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, encTicket))

                FormsAuthentication.RedirectFromLoginPage(userNameTB.Text, True)
                'FormsAuthentication.GetRedirectUrl(userNameTB.Text, True)
            End If

        Catch ex As Exception
            Response.Write("onAuthenticatedEvent produce the following error: " + ex.Message)
        End Try
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you share authentication related section from your web.config?