tags:

views:

11

answers:

1

I have two controllers:

  1. parent controller inherits from Controller.

    public class ApplicationController : Controller
    {
        public ApplicationController()
        {
        }
    }
    
  2. child controller inherits form above mentioned class.

    public class LayoutController : ApplicationController
    {
        public ActionResult Index()
        {
        }
    }
    

and have Initialize method in parent controller.

protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
}

and my question is that when "Initialize" method called then action is not call.

A: 

Make sure that you call the base method in Initialize:

protected override void Initialize(RequestContext requestContext)
{
    base.Initialize(requestContext);
}

And that you don't have an Index action in the base controller as you already do in the child controller.

I've just tried your sample code and it worked as expected.

Darin Dimitrov