redirecting from another page besides the login page

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default redirecting from another page besides the login page

    We have forms authentication working on a website. A user is presented the
    login page where he can login or press a button to go to the Registration
    page.

    In the Registration page, he puts in his data and submits it. If
    successful, he is taken to the login page to reenter is his username,
    password. Can we elminate this second step without compromising security?
    That is have the system login a user?

    I attempted to redirect him from the Registration page, but forms
    authentication will not allow that.

    The code to do the redirections is very simple:

    Private Sub RedirectUser(ByVal strUserName As String)

    Dim strReturnURL As String = Request.QueryString.Item("ReturnUrl")
    'create authentication ticket
    Dim authTicket As New FormsAuthenticationTicket(1, strUserName,
    DateTime.Now, DateTime.Now.AddMinutes(20), False, Session("WebRoles"))

    'Create encrypted string representation of ticket
    Dim strEncryptedTicket As String
    Try
    strEncryptedTicket = FormsAuthentication.Encrypt(authTicket)
    Catch ex As Exception
    Session("StringEncrptFailed") = ex.Message
    End Try

    'Store it within a HttpCookie Object
    Dim authCookie As New
    HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket)
    Dim strCookiePath As String = authCookie.Path
    'Add it the cookie to the outgoing cookie collection
    Try
    Response.Cookies.Add(authCookie)
    Catch ex As Exception
    Session("CookieAddFailed") = ex.Message
    End Try

    'Redirect the request
    Response.Redirect(FormsAuthentication.GetRedirectU rl(strUserName,
    True))


    End Sub
    --
    wr
    WhiskyRomeo Guest

  2. Similar Questions and Discussions

    1. making a login page which shud lead to a https page ?
      (Type your message here) making a login page which shud lead to a https page ? ne suggestions -------------------------------- From: sneha...
    2. Learningsite not redirecting to login page
      I hve seen the same problem...which will disappear after deactivating zonealarm!
    3. redirecting to a page
      Hi every one, How can I redirect to a page after having checked that user was logged in correctly .... select id_user, user_login,...
    4. redirecting from .aspx page to .asp page
      There is no great way to share session state between ASP and ASP.NET. But that doesn't mean you don't have options. Here are some common ways:...
    5. Redirecting to another page, after doing something
      Hi After I have done some work on one of my php pages, I want to go to another page, and have that display, but I can't seem to work out how to...
  3. #2

    Default RE: redirecting from another page besides the login page

    I think the answer to this problem is when the user sucessfully add himself
    the following lines of code are executed:

    FormsAuthentication.SetAuthCookie(tbEmail.Text, False)
    Response.Redirect("Public/Appt.aspx")

    I just want to make sure no compromise is made in security. Is there?

    "WhiskyRomeo" wrote:
    > We have forms authentication working on a website. A user is presented the
    > login page where he can login or press a button to go to the Registration
    > page.
    >
    > In the Registration page, he puts in his data and submits it. If
    > successful, he is taken to the login page to reenter is his username,
    > password. Can we elminate this second step without compromising security?
    > That is have the system login a user?
    >
    > I attempted to redirect him from the Registration page, but forms
    > authentication will not allow that.
    >
    > The code to do the redirections is very simple:
    >
    > Private Sub RedirectUser(ByVal strUserName As String)
    >
    > Dim strReturnURL As String = Request.QueryString.Item("ReturnUrl")
    > 'create authentication ticket
    > Dim authTicket As New FormsAuthenticationTicket(1, strUserName,
    > DateTime.Now, DateTime.Now.AddMinutes(20), False, Session("WebRoles"))
    >
    > 'Create encrypted string representation of ticket
    > Dim strEncryptedTicket As String
    > Try
    > strEncryptedTicket = FormsAuthentication.Encrypt(authTicket)
    > Catch ex As Exception
    > Session("StringEncrptFailed") = ex.Message
    > End Try
    >
    > 'Store it within a HttpCookie Object
    > Dim authCookie As New
    > HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket)
    > Dim strCookiePath As String = authCookie.Path
    > 'Add it the cookie to the outgoing cookie collection
    > Try
    > Response.Cookies.Add(authCookie)
    > Catch ex As Exception
    > Session("CookieAddFailed") = ex.Message
    > End Try
    >
    > 'Redirect the request
    > Response.Redirect(FormsAuthentication.GetRedirectU rl(strUserName,
    > True))
    >
    >
    > End Sub
    > --
    > wr
    WhiskyRomeo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139