• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

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

0
Robert Treadwell
Asked:
Robert Treadwell
1 Solution
 
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
 
CodeCruiserCommented:
Can you share authentication related section from your web.config?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now