public IActionResult Index(AuthorizationTable auth) { HttpClient client12 = cs.AuthClient(); var contentType = new MediaTypeWithQualityHeaderValue ("application/json"); client12.DefaultRequestHeaders.Accept.Add(contentType); string Data = JsonConvert.SerializeObject(auth); var contentData = new StringContent(Data, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = client12.PostAsync("api/Auth", contentData).Result; string jwtdata = response.Content.ReadAsStringAsync().Result; webtoken jwt = JsonConvert.DeserializeObject <webtoken>(jwtdata); if (jwt.Token == null) { return(RedirectToAction("Index")); } HttpContext.Session.SetString("token", jwt.Token); return(RedirectToAction("Access")); }