I am using surfacecontroller for login functionality.i
am using FormsAuthentication.SetAuthCookieto remember the user
credentials but it's not redirecting to to page after login
automatically.I am using umbraco version 6.0
[HttpPost] [ActionName("Login")] public ActionResult Login(LoginCommand command) {
if (ModelState.IsValid) { if (Membership.ValidateUser(command.Username, command.Password)) { FormsAuthentication.SetAuthCookie(command.Username,command.RememberMe); return RedirectToUmbracoPage(1112); } else { ModelState.AddModelError("Login", "Invalid username or password"); return CurrentUmbracoPage(); } } return CurrentUmbracoPage(); }
It's working when i hit url for /accountinformation.aspx it directly log me in and redirect to that page but when i am running homepage then it's rediecting to login page itself after login why so?? :(
I am not able to login when i added domain to web.config because i am getting logged in member as null.When i remove it i am able to login to site and also i am getting no values in cookie.When i hit the login url i am not getting cookie either.This is the login view
@{ Member member = umbraco.cms.businesslogic.member.Member.GetCurrentMember(); } <p>This page is under construction</p> <p>Logged in:@member.LoginName</p> <p>@Html.ActionLink("Log out", "Logout", "LoginSurface")</p>
FormsAuthentication.SetAuthCookie not working
Hi all
I am using surfacecontroller for login functionality.i am using FormsAuthentication.SetAuthCookieto remember the user credentials but it's not redirecting to to page after login automatically.I am using umbraco version 6.0
This is my web.config
Hi urmila,
Please insert domain='.yourdomain.com" to the forms line.
Check what cookies do you have.
Thanks,
Alex
Hi alex
what should be the domain name if i am running it on localhost?
Thanx,
Urmila
'localhost' ))
And when you will be on live you shoud change it to your real domain.
Cookies are strictly bound to the domain.
Thanks,
Alex
Hi alex
It's working when i hit url for /accountinformation.aspx it directly log me in and redirect to that page but when i am running homepage then it's rediecting to login page itself after login why so?? :(
<authentication mode="Forms">
<forms name="yourAuthCookie" loginUrl="login.aspx" protection="All" path="/" domain="127.0.0.1" defaultUrl="/accountinformation.aspx"/>
</authentication>
Thanks urmila
Look in your cookie, what wrong with your 'yourAuthCookie'.
could you watch on it ?
Hi alex
I am not able to login when i added domain to web.config because i am getting logged in member as null.When i remove it i am able to login to site and also i am getting no values in cookie.When i hit the login url i am not getting cookie either.This is the login view
And this the template to which i am redirecting after login
Thanks Urmila
Hi all
I finally found the solution
Just need to add this on my login view.
Thanks urmila
is working on a reply...