title: How do I make MVC look for razor and webforms views in the Views/Shared folder last?
body: <p>I have an older ASP.NET MVC application that uses classic web forms views.  As an experiment, we've started to mix in some razor views.  Unfortunately, the default precedence for where to find the desired view isn't what I want.  MVC first looks in your /Views/ControllerName folder for aspx and ascx files.  Then it moves to your /Views/Shared for aspx and ascx files.  Then it starts over looking for .cshtml and .vbhtml files.  What I want is for it not to go into the Shared folder until it's exhausted all the possibilities in the /Views/ControllerName folder.  How do I do this?</p>
  
  <p>--- UPDATE ---</p>
  
  <p>Here's some additional information that might help explain what I'm after.  By default, I get this search order:</p>
  
  <pre><code>~/Views/Home/Index.aspx
  ~/Views/Home/Index.ascx
  ~/Views/Shared/Index.aspx
  ~/Views/Shared/Index.ascx
  ~/Views/Home/Index.cshtml
  ~/Views/Home/Index.vbhtml
  ~/Views/Shared/Index.cshtml
  ~/Views/Shared/Index.vbhtml 
  </code></pre>
  
  <p>What I want is this:</p>
  
  <pre><code>~/Views/Home/Index.aspx
  ~/Views/Home/Index.ascx
  ~/Views/Home/Index.cshtml
  ~/Views/Home/Index.vbhtml
  ~/Views/Shared/Index.aspx
  ~/Views/Shared/Index.ascx
  ~/Views/Shared/Index.cshtml
  ~/Views/Shared/Index.vbhtml
  </code></pre>
  
  <p>In other words, it shouldn't search Shared before it searches the /Views/ControllerName folder completely.</p>