November Happy Hour will be moved to Thursday December 5th.

Jonas Bergqvist
Nov 9, 2012
  6682
(6 votes)

AmbiguousMatchException in MVC BlockController

Have you ever got the following error in the BlockController for our MVC API?

The current request for action 'Index' on controller type 'x' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index(y) on type x
System.Web.Mvc.ActionResult Index(y) on type z

If not, you will probably get it in the future. You get this error if you add an action called “Index” in your controller without overriding the index action in the base class. So please, when using a block controller, override the index action, or you may end up with an exception on your EPiServer Tech day presentation.

Nov 09, 2012

Comments

Fredrik Stolpe
Fredrik Stolpe Oct 28, 2014 09:12 AM

A message from the future: I got this error now and this post helped me, thanks :-)

Jens Qvist
Jens Qvist Oct 21, 2015 03:08 PM

Another message from the future. I got this error and this post helped me also! Thanks! :-D

Glenn Lalas
Glenn Lalas Jan 15, 2016 04:53 PM

Chiming in from 2016 to continue the trend of confirming how helpful this post was.  Thanks!  :)

Noel Sefton
Noel Sefton Feb 5, 2019 11:30 AM

yep, helped me as well... (6 years later)

public ActionResult Index(VeryImportantBlock currentBlock) { /*code in here*/ }

becomes

public override ActionResult Index(VeryImportBlock currentBlock) { /* code in here*/ }

Drew Douglas
Drew Douglas Apr 19, 2020 04:27 AM

This post was written 3 months before I got my first professional programming job and 2 years before I had ever hear of episerver, and it's still relavent 7.5 years later. Thanks @JonasBergvist!

Fredrik Stolpe
Fredrik Stolpe May 20, 2020 08:27 AM

Here again, 6 years later :-)

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog