- ABP Framework version: v4.2.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
I want to redirect a user to the actual login page https://localhost:44343/Account/Login if they are not logged in. Not the home page. I tried adding an override HomeController but it doesn't seem to be overriding the frameworks. I put a break poing in the Index method and it never gets hit. Any ideas why?
[Dependency(ReplaceServices = true)] public class HomeController : AbpController { public ActionResult Index() { if (CurrentUser.IsAuthenticated) { return View(); }
return Redirect("/Account/Login");
}
}
3 Answer(s)
-
0
hi joe@tronactive.com
I want to redirect a user to the actual login page https://localhost:44343/Account/Login if they are not logged in. Not the home page.
How to reproduce this?
-
0
Instead of going to the Home page with the login button. I want it to go to the https://localhost:44343/Account/Login. As you can see the images below. I was able to do this in the Angular version with the API with a HomeController and the below code. But in the MVC app it doesn't work.
public class HomeController : AbpController { public ActionResult Index() { if (CurrentUser.IsAuthenticated) { return View(); } return Redirect("/Account/Login"); } }
-
0
Nevermind, I was being stupid. I created a Home folder under Views/Home and then moved the index.html file from the Pages folder to that Views/Home folder and it worked as I wanted it to.