Hi
If user is not authenticated Login Page should Open but it is not opening. I need if User is not Login then Login View should be displayed.How this can be done
Home Controller
public class HomeController : Controller
{
[AllowAnonymous]
public ActionResult Index()
{
return View();
}
public ActionResult Login()
{
return PartialView("_Login");
}
[HttpPost]
[Authorize]
public ActionResult Logout()
{
FormsAuthentication.SignOut();
return RedirectToAction("Index");
}
}
Home Index - Blank 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 }
);
}
Web.Config
Thanks
Sachin SinghPosted Jun 22, 2021, 4:07 PM
Sachin SinghPosted Jun 23, 2021, 9:02 AM
Ramco RamcoPosted Jun 23, 2021, 8:53 AM
LogOn
Satya KarkiPosted Jun 23, 2021, 2:26 AM
Ramco RamcoPosted Jun 23, 2021, 1:36 AM
Rijwan AnsariPosted Jun 22, 2021, 5:43 PM
Sachin SinghPosted Jun 22, 2021, 5:28 PM
Satya KarkiPosted Jun 22, 2021, 4:49 PM
Ramco RamcoPosted Jun 22, 2021, 4:18 PM
Hi Sachin
Is this to be done on each Controller
[Authorize(Roles="Admin,Editor")]
Is it possible that it can Centralised at one location.
Thanks
Arnab MukherjeePosted Jun 22, 2021, 4:07 PM