title: How to use RedirectToAction to redirect to the default action of different controller?
body: <p>I am trying to do a RedirectToAction from <a href="http://mywebsite/Home/" rel="nofollow">http://mywebsite/Home/</a> using the following code:</p>
  
  <pre><code>return RedirectToAction("Index","Profile", new { id = formValues["id"] });
  </code></pre>
  
  <p>The above code will succesfully take me to</p>
  
  <p><a href="http://mywebsite/Profile/Index/223224" rel="nofollow">http://mywebsite/Profile/Index/223224</a></p>
  
  <p>What do I have to do to make it redirect to</p>
  
  <p><a href="http://mywebsite/Profile/223224" rel="nofollow">http://mywebsite/Profile/223224</a></p>
  
  <p>Thank you.</p>
  
  <p>I figured out how to do this.</p>
  
  <p>First I have to add custom route rule:</p>
  
  <pre><code>routes.MapRoute("Profile", "Profile/{id}", new { controller = "Profile", action = "Index", id = UrlParameter.Optional });
  </code></pre>
  
  <p>Then I can do the following:</p>
  
  <pre><code>[AcceptVerbs(HttpVerbs.Post)]
  public RedirectResult Index(FormCollection formValues)
  {
     return Redirect("~/Survey/" + formValues["Id"]);
  }
  </code></pre>