title: ASP.NET MVC View Engine Resolution Sequence
body: <p>I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which has one action Index. In the view, I created a corresponding Index.aspx under Product subfolder. </p>
  
  <p>Then I referenced the Spark dll and created Index.spark under the same Product view folder. The Application_Start looks like</p>
  
  <pre><code>    protected void Application_Start()
      {
          RegisterRoutes(RouteTable.Routes);
  
          ViewEngines.Engines.Clear();
          ViewEngines.Engines.Add(new Spark.Web.Mvc.SparkViewFactory());
  
          ViewEngines.Engines.Add(new WebFormViewEngine());
  
      }
  </code></pre>
  
  <p>My expectation is that since the Spark engine registers before default WebFormViewEngine, when browse the Index action in Product controller, the Spark engine should be used, and WebFormViewEngine should be used for all other urls.</p>
  
  <p>However, the test shows that the Index action for Product controller also uses the WebFormViewEngine. </p>
  
  <p>If I comment out the registration of WebFormViewEnginer (the last line in the code), I can see that the Index action is rendered by Spark engine and the rest urls generates an error (since the defualt engine is gone), it proves that all my Spark code is correct. </p>
  
  <p>Now my question is how the view engine is resolved? Why the registration sequence does not take effect?</p>