title: How to redirect to view from global exception filter in Asp.Net MVC
body: <p>I am working on a MVC using <strong>asp.net core</strong> where I have created a global filter to handling exceptions.
  Its handling exceptions but not redirecting to view(Error.cshtml) which is in <strong>Shared</strong> folder.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>public void OnException(ExceptionContext filterContext)
          {
              if (filterContext.ExceptionHandled)
              {
                  return;
              }
              Exception e = filterContext.Exception;
              filterContext.ExceptionHandled = true;
              string action = filterContext.RouteData.Values["action"].ToString();
              string controller = filterContext.RouteData.Values["controller"].ToString();
              filterContext.Result = new ViewResult()
              {
                  ViewName = "/Error" // also tried with "Error" and "~/Error"
              };
          }
  </code></pre>