I've created a page with Simple Rule Protection and a Login Page and an Error Page.
When I enter the protected page, I'm redirected to the Login page, which is what I've expected.
But when I login with username and password, I'm redirected back to the login page and not to the protected page as I've expected.
If I then manually go to the protected page I'm no loger required to enter username and password. So apparently I've used the correct username and password, but I've been redirected to the wrong page after login.
How do I get redirected to the right page after login ?
When I enter the protected page, I'm not redirected to the login page, my mistake. But I do see the login form. But when I submit that form I'm redirected to the /login page.
I've encountered this too - the default "Login.cshtml" snippet you're encouraged to use when building a simple login system, doesn't redirect you to the URL you originally requested.
I re-jigged it for my own purpose once — if I remember correct, you just need to add a hidden field for the RedirectUrl to the form, like this:
var loginModel = new LoginModel();
loginModel.RedirectUrl = HttpContext.Current.Request.Url.AbsolutePath;
...
@using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))
{
@Html.HiddenFor(m => loginModel.RedirectUrl)
<fieldset>
<legend>Login</legend>
...
}
Simple Rule Protection login returns to login
I've created a page with Simple Rule Protection and a Login Page and an Error Page.
When I enter the protected page, I'm redirected to the Login page, which is what I've expected.
But when I login with username and password, I'm redirected back to the login page and not to the protected page as I've expected.
If I then manually go to the protected page I'm no loger required to enter username and password. So apparently I've used the correct username and password, but I've been redirected to the wrong page after login.
How do I get redirected to the right page after login ?
That really depends on your login page implementation.
Normally when you see the login page, the url of the page is not the url for the Login page but for your hidden page.
And after correct login it would redirect to the same url.
How is your login.cshtml?
Hi Rasmus,
My login.cshtml looks like the example in this post: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/71701-basic-member-login-form-umbraco
When I enter the protected page, I'm not redirected to the login page, my mistake. But I do see the login form. But when I submit that form I'm redirected to the /login page.
Hi Sebastian,
I've encountered this too - the default "Login.cshtml" snippet you're encouraged to use when building a simple login system, doesn't redirect you to the URL you originally requested.
I re-jigged it for my own purpose once — if I remember correct, you just need to add a hidden field for the
RedirectUrl
to the form, like this:/Chriztian
is working on a reply...