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
<authentication mode="Forms"> <forms loginUrl="~/Home/Login" timeout="2880" /> </authentication>
Thanks