title: ASP.NET MVC: How to access View Name in a Action Filter
body: <p>I have written below Action Filter for model validation-</p>
  
  <pre><code>    public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          var viewData = filterContext.Controller.ViewData;
          var viewNme = filterContext.Controller;
          if (!viewData.ModelState.IsValid)
          {
              filterContext.Result = new ViewResult
              {
                  ViewData = viewData,
                  ViewName = "Test"
  
              };
          }
          base.OnActionExecuting(filterContext);
      }
  </code></pre>
  
  <p>if I do not pass   <code>ViewName = "WhitePaper"</code>  It fails with below message - 
  Server Error in '/Travelers.eBusiness.Travelers.Web' Application.</p>
  
  <p>The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:</p>
  
  <p>My question is - 
  How do I pass view info ? </p>