Esempio n. 1
0
        public ActionResult Index(AuthenticationViewModel model)
        {
            if (_client.PostAsJsonAsync("authentication", model).Result.StatusCode == HttpStatusCode.OK)
            {
                _formsAuthentication.SetAuthenticationToken(model.Username);
                return RedirectToAction("Index", "Home");
            }

            return View();
        }
        public ActionResult Index(AuthenticationViewModel model)
        {
            var result = Client.PostAsJsonAsync("authentication", model).Result;

            if (result.StatusCode == HttpStatusCode.OK)
            {
                FormsAuthentication.SetAuthenticationToken(result.Content.ReadAsAsync<string>().Result);
                return RedirectToAction("Index", "Home");
            }

            return View();
        }