title: MVC controller action overload
body: <p>Can I do something similar to this in a way that doesn't throw an error:</p>
  
  <pre><code>public class AdsController : Controller
  {
    AdsRepository repo = new AdsRepository();
  
    public ActionResult Details(string id)
    {
      AdSlots adslot = new AdSlots();
      Enum.TryParse(id, true, out adslot);
      return Content(repo.GetInvocationCode(adslot, Global.SiteInfo.ID));
    }
  
    [ChildActionOnly]
    public ActionResult Details(AdSlots slot)
    {
      return Content(repo.GetInvocationCode(slot, Global.SiteInfo.ID));
    }
  
  }
  </code></pre>
  
  <p>The point is that I want to have a way of accessing the resource through /ads/details/leaderboard as a url in the browser, but also in master pages using:</p>
  
  <pre><code> &lt;% Html.RenderAction("Details", "Ads", new {slot = AdSlots.Leaderboard }); %&gt;
  </code></pre>
  
  <p>I just think that is cleaner than:</p>
  
  <pre><code> &lt;% Html.RenderAction("Details", "Ads", new {slot = "Leaderboard" }); %&gt;
  </code></pre>
  
  <p>If I do as above and call the url /ads/details/leaderboard I get this error:</p>
  
  <blockquote>
    <p>The current request for action 'Details' on controller type 'AdsController' is ambiguous between the following action methods.. etc</p>
  </blockquote>
  
  <p>I didn't think I would get that error as I have given the attribute [ChildActionOnly] to the other action. I would think then it was obvious for the system that if I access it through the browser I would only have one option, not so apparently.</p>