I'm using ASP.NET Core 2.2 in my project, in one of action method, I am storing data in tempdata and redirecting to SSO site for user validation. Later in MethodB which is callback method i get user details. But when am trying to get details from tempdata that i stored in MethodA, i get always null. Infact i tried with using sessions too but that is also getting null if i use Response.Redirect but works fine when i use RedirectToAction. Its seems Respose.Redirect is causing issue. Do anyone can suggest what could be issue and any possible solution?
[TempData]
public string Message1 { get; set; }
public void MethodA()
{
TempData["Message2"] = "Some Value";
Response.Redirect("SSOSite.com");
}
public void MethodB()
{
var message1 = Message1;
var message2 = TempData["Message2"];
}