However, my login stuff is held on a separate page rather than on my home page. When the user logs in, I want to be able to redirect to my home page. Could someone please show me how I can do this?
Or if you look at the sourcecode you can also pass a RedirectUrl value. If you have a hidden input named RedirectUrl with the url as value that might also work.
@*
Here you can specify a redirect URL for after logging out, by default umbraco will simply
redirect to the current page. Example to redirect to the home page:
logoutModel.RedirectUrl = "/";
*@
@Html.HiddenFor(m => logoutModel.RedirectUrl)
UmbLoginController page redirect
I'm using the inbuilt umbraco log in controller to deal with the handling of signing users into my site.
Nothing too strenuous and looks like this:
However, my login stuff is held on a separate page rather than on my home page. When the user logs in, I want to be able to redirect to my home page. Could someone please show me how I can do this?
I think it's better to build your own LoginController in that case. Make your own controller and copy over from the soucecode: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Controllers/UmbLoginController.cs
Or if you look at the sourcecode you can also pass a RedirectUrl value. If you have a hidden input named RedirectUrl with the url as value that might also work.
Jeroen
Thanks for the reply.
I tried creating my own log in MVC but there is a lot functionality already built upon what I have already.
Do you have any examples of how I could pass in that hidden value by any chance?
This is all very new to me.
have a look on the "Login Status" snippet:
To elaborate on Vlax's note, you can add this under the login model declaration:
var loginModel = new LoginModel();
loginModel.RedirectUrl = "/your-redirect-url/";
Then inside the form add this:
@Html.HiddenFor(m => loginModel.RedirectUrl)
That's it....
Cheers,
Jamie
This is all I needed. Thank you thank you thank you!
For anyone who is interested, here is my Partial View Macro for Login (with my own HTML and CSS markup that would need to be changed)
Beautiful. Thank you for sharing, this is awesome and very easy.
is working on a reply...