title: How to set view model on ViewResult in request filter?
body: <p>I make a MVC project and I want set Model into View from filter.</p>
  
  <p>But I do not kown ,How can I do this.</p>
  
  <p>the Model:</p>
  
  <pre><code>public class TestModel
  {
      public int ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>Contorller:</p>
  
  <pre><code>[CustomFilter(View = "../Test/Test")]//&lt;===/Test/Test.cshtml
  public ActionResult Test(TestModel testModel)//&lt;===Model from Page
  {
        //the Model has Value!!
         // if has some exception here
          return View(model);//&lt;=====/Test/Test.cshtml
  }
  </code></pre>
  
  <p>filter(just demo):</p>
  
  <pre><code>public override void OnActionExecuting(ActionExecutingContext filterContext){
       ViewResult vr = new System.Web.Mvc.ViewResult()
       {
              ViewName = this.View,//&lt;======/Test/Test.cshtml
              ViewData = filterContext.Controller.ViewData                             
        };
        //How can I set Model here?!!
        vr.Model = ???? //&lt;========the Model is only get
        filterContext.Result = vr;
  }
  </code></pre>
  
  <p><strong>Edit begin</strong> thanks for @Richard Szalay @Zabavsky @James @spaceman</p>
  
  <p>change filter extends to HandleErrorAttribute</p>
  
  <pre><code>  ViewResult vr = new System.Web.Mvc.ViewResult()
       {
              ViewName = this.View,//&lt;======/Test/Test.cshtml
              ViewData = new ViewDataDictionary(filterContext.Controller.ViewData)
              {
                  //I want get testModel from Action's paramater
                  //the filter extends HandleErrorAttribute
                  Model = new { ID = 3, Name = "test" }// set the model
              }                             
        };
  </code></pre>
  
  <p><strong>Edit end</strong></p>
  
  <p>Test/Test.chtml</p>
  
  <pre><code>@model TestModel
  &lt;h2&gt;Test&lt;/h2&gt;
  @Model //&lt;=====model is null
  </code></pre>
  
  <p>when I request </p>
  
  <pre><code>http://localhost/Test/Test?ID=3&amp;Name=4
  </code></pre>
  
  <p>The Test Page can not get Model.</p>