views:

119

answers:

0

how would i go about finding out what action was defined for this function

    protected override void ProcessRequest(HttpContextBase httpContext)
    {
        IController Controller = new CatalogController();
        (Controller as Controller).ActionInvoker = new MyActionInvoker();
        Controller.Execute(RequestContext);
    }

as in

    routes.Add(
            new Route("Catalog/{*data}",
                new RouteValueDictionary(new { controller = "Catalog", action = "Category", data = "" }),
                new MyRouteHandler()));

how could i find out that action was equal to Category from the ProcessRequest function. reason im wanting this is, i want to maybe add another ActionInvoker for another action instead of one for the whole controller

this is what im trying to do

    protected override void ProcessRequest(HttpContextBase httpContext)
    {
        IController Controller = new CatalogController();

        if (Action == something)
        {
            (Controller as Controller).ActionInvoker = new MyActionInvoker();
            Controller.Execute(RequestContext);
        }
        else
        {
            do this actioninvoker instead
        }
    }

Never Mind i figured it out thanks tho

    protected override void ProcessRequest(HttpContextBase httpContext)
    {
        m_controller = RequestContext.RouteData.Values["controller"].ToString();
        m_action = RequestContext.RouteData.Values["action"].ToString();

        if (m_controller.Contains("Catalog"))
        {
            IController Controller = new CatalogController();

            if (m_action.Contains("Category"))
            {
                (Controller as Controller).ActionInvoker = new MyActionInvoker();
            }

            Controller.Execute(RequestContext);
        }
        else
        {
            base.ProcessRequest(httpContext);
        }
    }