Im adding members login to my umbraco 8 website, I've got everything working and members can log in/out. However what I want to do is once the member logs in then redirect to the home page.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using System.Web;
using System.Web.Mvc;
using Engage.Models;
using Umbraco.Web.Mvc;
namespace Engage.Controllers
{
public class MemberController : SurfaceController
{
public ActionResult RenderLogin()
{
return PartialView("_Login", new LoginModel());
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SubmitLogin(LoginModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (Membership.ValidateUser(model.Username, model.Password))
{
FormsAuthentication.SetAuthCookie(model.Username, false);
UrlHelper myHelper = new UrlHelper(HttpContext.Request.RequestContext);
if (myHelper.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return Redirect("/login/");
}
}
else
{
ModelState.AddModelError("", "The username or password provided is incorrect.");
}
}
return CurrentUmbracoPage();
}
public ActionResult RenderLogout()
{
return PartialView("_Logout", null);
}
public ActionResult SubmitLogout()
{
TempData.Clear();
Session.Clear();
FormsAuthentication.SignOut();
return RedirectToCurrentUmbracoPage();
}
}
}
Members login redirect
Hi,
Im adding members login to my umbraco 8 website, I've got everything working and members can log in/out. However what I want to do is once the member logs in then redirect to the home page.
Here is my code;
And my controller
Thanks in advance,
is working on a reply...