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

Robert TreadwellManaging DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

louisfrCommented:
Login.aspx has two parameters:
ReturnUrl, value %2fForms%2fCRE4.aspx%3fid%3d316
id, value 316

The ReturnUrl parameter is the encoded url /Forms/CRE4.aspx?id=316. It has the parameters it was requested with.
The Login page also has the same parameters as the requested page, so that you can access those and act accordingly.

A detailed explanation here : http://blogs.msdn.com/b/vijaysk/archive/2008/01/24/anatomy-of-forms-authentication-return-url.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
Can you share authentication related section from your web.config?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.