title: Vanity profile URL in ASP.net
body: <p>I am creating an application in ASP.net where each user will have their own profile that they can share with others.</p>
  
  <p>the default address for their profile will be:</p>
  
  <pre><code>www.domain.com/User/Profile/[UserID]
  </code></pre>
  
  <p>when they specify a vanity URL, someone can enter</p>
  
  <pre><code>www.domain.com/User/Profile/[Vanity]
  </code></pre>
  
  <p>and be directed to the same page. The profile page works with only one function taking in a UserID with the following function in the controller:</p>
  
  <pre><code>    public ActionResult Profile(int id)
      {
          ppUser viewerChoice = DB.User_GetUserByPersonID(id);
  
          return View(viewerChoice);
      }
  </code></pre>
  
  <p>However, when I add another that takes a string</p>
  
  <pre><code>    public ActionResult Profile(string vanity)
      {
          ppUser viewerChoice = DB.User_GetUserByVanity(vanity);
  
          return View(viewerChoice);
      }
  </code></pre>
  
  <p>This causes an AmbiguousMatch Exception. How would I go about making sure that it calls the correct function?</p>