Hi
Below is the Layout . I want to check if user is authenticated only then Layout Page should open else it should go to Login Screen,
LAYOUT PAGE
Route.Config
**************
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Home Controller *************************
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult Login(string ReturnUrl)
{
ViewBag.ReturnUrl = ReturnUrl;
//return View();
return View();
}
}
Thanks

Varun SetiaRank #308 · 8.2K reputationPosted Jun 24, 2021, 5:18 AM EDT
Varun SetiaRank #308 · 8.2K reputationPosted Jun 24, 2021, 3:18 AM EDT
Note: Do not use same layout for Login
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 24, 2021, 3:21 AM EDT
Varun SetiaRank #308 · 8.2K reputationPosted Jun 24, 2021, 3:23 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 24, 2021, 3:38 AM EDT
simply set the Login page as the startup page, for the rest of the application your Authorization module will work as expected.
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 24, 2021, 4:45 AM EDT
Varun SetiaRank #308 · 8.2K reputationPosted Jun 24, 2021, 4:52 AM EDT
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 24, 2021, 5:08 AM EDT
Hi Varun
STill getting error. Secondly is my Home Controller LOgin Http Action is correct
https://imgur.com/ogRDGyk
https://imgur.com/ogRDGyk
Thanks
Sachin SinghRank #66 · 26.2K reputationPosted Jun 24, 2021, 6:05 AM EDT
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 24, 2021, 7:18 AM EDT