Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wheelibin on github.
  • I am wheelibin (https://keybase.io/wheelibin) on keybase.
  • I have a public key ASCPMVwNGu1I-fzAlOXeugjZaL3PNwW5mR_funC5Idv_pAo

To claim this, I am signing this object:

@wheelibin
wheelibin / ModelStateTempDataFilters.cs
Created February 13, 2013 07:51
Pass ModelState between actions - Allows you to do a redirect to the GET action and retain the ModelState after a failed update (instead of recreating the view model and potentially repeating yourself).
public abstract class ModelStateTempDataTransfer : ActionFilterAttribute
{
protected static readonly string Key = typeof(ModelStateTempDataTransfer).FullName;
}
public class ExportModelStateToTempData : ModelStateTempDataTransfer
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
//Only export when ModelState is not valid