Altering RedirectFromLoginPage redirction page

  • Thread starter Thread starter Ben Fidge
  • Start date Start date
B

Ben Fidge

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
 
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.
 
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");
 
Back
Top