I would like to define an extension controller method. Is this possible? When I try it, it compiles, but I receive a 404, instead of a 200.
public static ActionResult MyMethod(this Controller)
{
return new EmptyResult();
}
You can't have a static action method, so this won't work.
What you could do instead is create a base controller class with a public instance method:
public class BaseController : Controller
{
public ActionResult MyMethod()
{
return new EmptyResult();
}
}