Altering RedirectFromLoginPage redirction page

Discussion in 'ASP .Net' started by Ben Fidge, Nov 6, 2005.

  1. Ben Fidge

    Ben Fidge Guest

    Hi

    I have an app that requires the following scenarios:

    - A registererd user can login via a login page. This will redirect them
    to Default.aspx via the use of FromsAuthentication.RedirectFromLoginPage
    - A new user can register and on completion, will automatically get
    logged in and then get redirected to a different page.

    I can't implement the second scenario using RedirectFromLoginPage as it
    insists on going to default.aspx. However, on completion of registration, it
    would be very nice to autatically log the user in and then redirect them to
    this other page.

    Is there any way of doing this with ASP.NET?

    Ben
     
    Ben Fidge, Nov 6, 2005
    #1
    1. Advertising

  2. Ben Fidge

    Mr Newbie Guest

    Why dont you add the functionality to the same page ie (Login or Register),
    you could optionally have a new form pop up to take the details and return
    them to the login form. One successfull registration is complete, the fields
    for username and password could be automatically filled in ready for login.

    --
    Best Regards

    The Inimitable Mr Newbie º¿º



    "Ben Fidge" <> wrote in message
    news:%...
    > Hi
    >
    > I have an app that requires the following scenarios:
    >
    > - A registererd user can login via a login page. This will redirect
    > them to Default.aspx via the use of
    > FromsAuthentication.RedirectFromLoginPage
    > - A new user can register and on completion, will automatically get
    > logged in and then get redirected to a different page.
    >
    > I can't implement the second scenario using RedirectFromLoginPage as it
    > insists on going to default.aspx. However, on completion of registration,
    > it would be very nice to autatically log the user in and then redirect
    > them to this other page.
    >
    > Is there any way of doing this with ASP.NET?
    >
    > Ben
    >
    >
     
    Mr Newbie, Nov 6, 2005
    #2
    1. Advertising

  3. Ben Fidge

    Ben Fidge Guest

    I actually solved it using the following in the Confirm button OnClick:

    FormsAuthenticationTicket oTicket = new FormsAuthenticationTicket(
    1,
    sUserName
    DateTime.Now,
    DateTime.Now.AddMinutes(20),
    false,
    "",
    FormsAuthentication.FormsCookiePath);

    // Encrypt the ticket.
    string oEncTicket = FormsAuthentication.Encrypt(oTicket);

    // Create the cookie.
    Response.Cookies.Add(new
    HttpCookie(FormsAuthentication.FormsCookieName, oEncTicket));

    Response.Redirect("UserRegistered.aspx");


    "Mr Newbie" <> wrote in message
    news:...
    > Why dont you add the functionality to the same page ie (Login or
    > Register), you could optionally have a new form pop up to take the details
    > and return them to the login form. One successfull registration is
    > complete, the fields for username and password could be automatically
    > filled in ready for login.
    >
    > --
    > Best Regards
    >
    > The Inimitable Mr Newbie º¿º
    >
    >
    >
    > "Ben Fidge" <> wrote in message
    > news:%...
    >> Hi
    >>
    >> I have an app that requires the following scenarios:
    >>
    >> - A registererd user can login via a login page. This will redirect
    >> them to Default.aspx via the use of
    >> FromsAuthentication.RedirectFromLoginPage
    >> - A new user can register and on completion, will automatically get
    >> logged in and then get redirected to a different page.
    >>
    >> I can't implement the second scenario using RedirectFromLoginPage as it
    >> insists on going to default.aspx. However, on completion of registration,
    >> it would be very nice to autatically log the user in and then redirect
    >> them to this other page.
    >>
    >> Is there any way of doing this with ASP.NET?
    >>
    >> Ben
    >>
    >>

    >
    >
     
    Ben Fidge, Nov 6, 2005
    #3
  4. Ben Fidge

    Mr Newbie Guest

    Okely Dokely !

    --
    Best Regards

    The Inimitable Mr Newbie º¿º



    "Ben Fidge" <> wrote in message
    news:%...
    >I actually solved it using the following in the Confirm button OnClick:
    >
    > FormsAuthenticationTicket oTicket = new FormsAuthenticationTicket(
    > 1,
    > sUserName
    > DateTime.Now,
    > DateTime.Now.AddMinutes(20),
    > false,
    > "",
    > FormsAuthentication.FormsCookiePath);
    >
    > // Encrypt the ticket.
    > string oEncTicket = FormsAuthentication.Encrypt(oTicket);
    >
    > // Create the cookie.
    > Response.Cookies.Add(new
    > HttpCookie(FormsAuthentication.FormsCookieName, oEncTicket));
    >
    > Response.Redirect("UserRegistered.aspx");
    >
    >
    > "Mr Newbie" <> wrote in message
    > news:...
    >> Why dont you add the functionality to the same page ie (Login or
    >> Register), you could optionally have a new form pop up to take the
    >> details and return them to the login form. One successfull registration
    >> is complete, the fields for username and password could be automatically
    >> filled in ready for login.
    >>
    >> --
    >> Best Regards
    >>
    >> The Inimitable Mr Newbie º¿º
    >>
    >>
    >>
    >> "Ben Fidge" <> wrote in message
    >> news:%...
    >>> Hi
    >>>
    >>> I have an app that requires the following scenarios:
    >>>
    >>> - A registererd user can login via a login page. This will redirect
    >>> them to Default.aspx via the use of
    >>> FromsAuthentication.RedirectFromLoginPage
    >>> - A new user can register and on completion, will automatically get
    >>> logged in and then get redirected to a different page.
    >>>
    >>> I can't implement the second scenario using RedirectFromLoginPage as it
    >>> insists on going to default.aspx. However, on completion of
    >>> registration, it would be very nice to autatically log the user in and
    >>> then redirect them to this other page.
    >>>
    >>> Is there any way of doing this with ASP.NET?
    >>>
    >>> Ben
    >>>
    >>>

    >>
    >>

    >
    >
     
    Mr Newbie, Nov 6, 2005
    #4
    1. Advertising

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. Lauchlan M
    Replies:
    2
    Views:
    500
    John Saunders
    Aug 17, 2003
  2. Rob Heckart
    Replies:
    6
    Views:
    550
    Rob Heckart
    Nov 26, 2003
  3. Edward Mitchell
    Replies:
    8
    Views:
    1,758
    Steven Cheng[MSFT]
    Feb 22, 2005
  4. Jeremy Chapman
    Replies:
    1
    Views:
    2,968
    ajamrozek
    Sep 21, 2005
  5. Nugs
    Replies:
    1
    Views:
    147
    Marcio Kleemann
    May 26, 2004
Loading...

Share This Page