I\'ve been trying to pass data to an action after a redirect by using TempData like so:
if (!ModelState.IsValid)
{
TempData[\"ErrorMessages\"] = ModelSta
I can not comment but I added a PEEK as well which is nice to check if there or read and not remove for the next GET.
public static T Peek(this ITempDataDictionary tempData, string key) where T : class
{
object o = tempData.Peek(key);
return o == null ? null : JsonConvert.DeserializeObject((string)o);
}
Example
var value = TempData.Peek("key") where value retrieved will be of type ClassA