I am getting the error
the current request is ambiguous between the following action methods: System.Web.Mvc.ActionResult Foo1(System.String) on type Project.Web.Controllers.PageController System.Web.Mvc.ActionResult Foo2(System.String) on type Project.Web.Controllers.PageController
The a href calling the ActionResults are
<a href="@Url.Action("Foo1", "Page", new { page = "Foo1" })">Foo1</a>
<a href="@Url.Action("Foo2", "Page", new { page = "Foo2" })">Foo2</a>
I am basically passing the string instead of a int id ( I realise this is not the best way to do this , but that is not the issue i want to address here )
This allows me to add a string parameter to the Routing for clean urls, so my ActionResult is now
[AllowAnonymous, Route("{page}")]
public ActionResult Foo1(string page)
{
...
}
and
[AllowAnonymous, Route("{page}")]
public ActionResult Foo2(string page)
{
...
}
Why is there ambiguity when the links are being passed to different ActionResults and the parameters are different?
[AllowAnonymous, Route("{page/Foo2}")]for your second ActionResult[AllowAnonymous, Route("Foo1")] public ActionResult Foo1(string page) { ..... } [AllowAnonymous, Route("Foo2")] public ActionResult Foo2(string page) { ....... }and then action<a href="@Url.Action("Foo1")">Foo1</a>