I want to create login page using authentication token.ApplicationOAuthProvider alread have functionality for login.but i dont know how to call the function in controller
This is i try
[HttpPost]
//[ValidateAntiForgeryToken]
public ActionResult Login(Login model)
{
HttpClient hc = new HttpClient();
hc.BaseAddress = new Uri("https://localhost:44357/Token");
var insertdata = hc.PostAsJsonAsync("Token", model);
insertdata.Wait();
var savedata = insertdata.Result;
if (savedata.IsSuccessStatusCode)
{
ViewBag.message = "The user" + model.UserName + "Is Saved Successfully ... !";
return View("Home");
}
return View();
}
//[ValidateAntiForgeryToken]
public ActionResult Login(Login model)
{
HttpClient hc = new HttpClient();
hc.BaseAddress = new Uri("https://localhost:44357/Token");
var insertdata = hc.PostAsJsonAsync
insertdata.Wait();
var savedata = insertdata.Result;
if (savedata.IsSuccessStatusCode)
{
ViewBag.message = "The user" + model.UserName + "Is Saved Successfully ... !";
return View("Home");
}
return View();
}

Salman BegRank #284 · 8.8K reputationPosted Apr 23, 2021, 9:08 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Apr 26, 2021, 12:20 AM EDT