I am facing issues with TempData after Redirect.
public ActionResult LoginCredentials()
{
// Calling "SetError()" in catch(), if password mismatch.
try{}
catch()
{
return SetError();
}
}
public ActionResult SetError()
{
// set the value of TempData as "true"
TempData["error"] = true;
return Redirect("/Login");
}
public ActionResult Index()
{
ViewData["useError"]= TempData["error"]; // at this point TempData["error"] is null.
...
}
In SetError() value of TempData is successfully set as true, issue takes place after "Redirect", value becomes "null" and I can't use it anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With