title: Dynamic Layout for Error View in ASP.Net MVC
body: <p>I have two action called "a" and "b". also I have two view for them. the layout of these views is difference.
  for a:</p>
  
  <pre><code>@{
      Layout = "~/Views/Shared/_X.cshtml";
  }
  </code></pre>
  
  <p>for b:</p>
  
  <pre><code>@{
      Layout = "~/Views/Shared/_Y.cshtml";
  }
  </code></pre>
  
  <p>also the Error view is shared.</p>
  
  <p>How can I use a dynamic layout for Error view. for example when an error occurred while processing action "a" the error show in layout of action "a" and if an error occurred while processing action "b" the error show in layout of action "b"?</p>