コード例 #1
0
        public ActionResult UserLogin(LoginDetails data)
        {
            if (data == null || string.IsNullOrEmpty(data.UserName) || string.IsNullOrEmpty(data.Password))
            {
                return(null);
            }

            if (ConfigurationManager.AppSettings["AdminUserName"] == data.UserName && ConfigurationManager.AppSettings["AdminPassword"] == data.Password)
            {
                if (Session["AdminUserName"] == null || Session["AdminPassword"] == null)
                {
                    Session.Add("AdminUserName", data.UserName);
                    Session.Add("AdminPassword", data.Password);
                }

                return(Json(new { result = "Redirect", url = Url.Action("Index", "Home") }));
            }

            return(View());
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: viren85/moviemirchi
        public ActionResult UserLogin(LoginDetails data)
        {
            if (data == null || string.IsNullOrEmpty(data.UserName) || string.IsNullOrEmpty(data.Password))
            {
                return null;
            }

            if (ConfigurationManager.AppSettings["AdminUserName"] == data.UserName && ConfigurationManager.AppSettings["AdminPassword"] == data.Password)
            {
                if (Session["AdminUserName"] == null || Session["AdminPassword"] == null)
                {
                    Session.Add("AdminUserName", data.UserName);
                    Session.Add("AdminPassword", data.Password);
                }

                return Json(new { result = "Redirect", url = Url.Action("Index", "Home") });
            }

            return View();
        }