I have a ASP.NET Login Control with Forms authentication.Even after successful Login it does not redirects to destination page.But it uses returnURL and stays at same Login page.How to make Login Control to redirect to specified destination page?
views:
23answers:
1
A:
If you haven't done so already, I think you just need to set the default url in the forms tag (web.config like so)
<forms loginUrl="blablabla.aspx" defaultUrl="YourDefaultPage.aspx" />
Give it a go and let us know how you get on.
adrianos
2010-10-13 08:14:43
I also already set the default url in web.config file..but its not redirecting..i also used Login1_LoggedIn event which has a response.redirect to another page..that event is fired and all that response.redirect is also called..but fails to redirect..
Abilash
2010-10-13 08:38:48
@Abilash - can you please post the code in `Login1_LoggedIn`? Might help with the solution. Based on your comment "Response.Redirect is also called..but fails to redirect" - you should be using `RedirectFromLoginPage`. This will use the ReturnUrl QS and redirect appropriately.
RPM1984
2010-10-13 08:44:46
This is my code: protected void Login1_LoggedIn(object sender, EventArgs e) { if (Roles.IsUserInRole(Login1.UserName, "Admin1")) { Response.Redirect("~/Pages/UserManagement/changepassword.aspx"); }}
Abilash
2010-10-13 09:18:00
is it going into the response.redirect portion of the code?
adrianos
2010-10-13 09:26:12
ya it was going..
Abilash
2010-10-13 09:36:14
Can you post the html for the login control (in the aspx)?
adrianos
2010-10-13 09:38:09
@ RPM1984,adrainos-Now it is redirecting to the respective pages..did some changes in web.config file..Thanks friends..
Abilash
2010-10-13 09:38:19