Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9242575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:36:29+00:00 2026-06-18T08:36:29+00:00

When a view has been rendered in memory and before it is sent as

  • 0

When a view has been rendered in memory and before it is sent as a response to the client, I would like to intercept the call, check which view is being rendered, what was the action and controller, and do some house-keeping.

Therefore, I am implementing a ResultFilter and overriding the OnResultExecuted method.

Within this method, how do I get the route data to figure out which view, action, controller were called?

Update
My profuse apologies. I just looked up ResultExecutedContext in reflector and it showed me only an Exception, Cancelled and ActionResult property. It didn’t show me any RouteData. When I fired up the IDE, it did show me the route data. I feel like a dick for asking this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:36:31+00:00Added an answer on June 18, 2026 at 8:36 am

    You could get it from the filterContext‘s RouteData property:

    public override void OnResultExecuted(ResultExecutedContext filterContext)
    {
        RouteData rd = filterContext.RouteData;
        // read from the current request RouteData the information
        // you were looking for. For example to get the current controller
        // and action:
        string currentController = rd.GetRequiredString("controller");
        string currentAction = rd.GetRequiredString("action");
    }
    

    As far as which view was rendered is concerned you could retrieve this information from the Result property:

    var viewResult = filterContext.Result as ViewResultBase;
    if (viewResult != null)
    {
        // the controller action returned a view result (either a ViewResult or PartialViewResult)
        // so we could retrieve the view name here:
        string viewName = viewResult.ViewName;
    }
    

    If on the other hand the controller action returned a JsonResult you could also extract retrieve it:

    var jsonResult = filterContext.Result as JsonResult;
    

    and so on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any delegate or some notification which tells that scroll view has been
I use... -(void)didRotateFromInterfaceOrientation: ... to adapt a view that has been rotated to landscape.
Once code has been written, the only way I know of to view the
I have senario in which one view and view has binding with multiple ViewModel.
in iPhone, this would be simple---each view has a scrollViewDidScroll method. I am trying
I would like to have an OpenGL view with an utility application. What I
I want to detect if mytable view has been scrolled, I tried all touch
Is there way to update a record after something has been rendered without putting
How can I determine if a buffer has been allocated on GPU memory on
The ActiveScaffold list view has a search form that is loaded via ajax when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.