Ramco Ramco

Ramco Ramco

  • 471
  • 2.8k
  • 393.5k

LogOn Partial View

Jun 14 2021 11:27 AM

Hi

  I want if user has not logged in then below View should open.

@Html.Partial("_LogOnPartial")

In ViewStart below is the Code . I want if User is not logged in then Login Partial Modal Popup should open.

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

In Web.Config i have written below code

 <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>

******************************************************************

public class RouteConfig
    {
        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 }
            );
        }
    }

  *********************************************************************************************************

public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
    }

   
 Thanks 

 


Answers (1)