Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am working on mvc3. i set default rout in Gloabl.asax which is given below

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Job", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

This is the default rout of my project. i have also two layout page, one is page layout(_Layout.cshtml) and second is for login page(_login.cshtml). i just want to set when Request.IsAuthencated true then default route display with _Layout.cshtml and when Request.IsAuthencated false then _login.cshtml show be display. and i set in _ViewStart.cshtml is

@{
if
C#
(Request.IsAuthenticated)
   {
       Layout = "~/Views/Shared/_Layout.cshtml";
   }
   else
   {
       Layout = "~/Views/Shared/Login.cshtml";
   }


}

please help how can i do this. please help
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900