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
Ramco RamcoPosted Jun 24, 2021, 11:18 AM
Sachin SinghPosted Jun 24, 2021, 10:05 AM
Varun SetiaPosted Jun 24, 2021, 9:18 AM
Ramco RamcoPosted Jun 24, 2021, 9:08 AM
Hi Varun
STill getting error. Secondly is my Home Controller LOgin Http Action is correct
https://imgur.com/ogRDGyk
https://imgur.com/ogRDGyk
Thanks
Varun SetiaPosted Jun 24, 2021, 8:52 AM
Ramco RamcoPosted Jun 24, 2021, 8:45 AM
Sachin SinghPosted Jun 24, 2021, 7:38 AM
simply set the Login page as the startup page, for the rest of the application your Authorization module will work as expected.
Varun SetiaPosted Jun 24, 2021, 7:23 AM
Ramco RamcoPosted Jun 24, 2021, 7:21 AM
Varun SetiaPosted Jun 24, 2021, 7:18 AM
Note: Do not use same layout for Login