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 4102208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:47:47+00:00 2026-05-20T20:47:47+00:00

Is is possible in EndRequest handler in Global.asax.cs in Asp .NET MVC 2 to

  • 0

Is is possible in EndRequest handler in Global.asax.cs in Asp .NET MVC 2 to idenfity whether current request handled by a mvc controller rather than a request to fetch some resource file (js, css, an image)? What further interests me, is it possible to do so even when response was once generated using a controller but is not served from OutputCache.

  • 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-05-20T20:47:47+00:00Added an answer on May 20, 2026 at 8:47 pm

    I think that you can run this code: this.Context.Handler is MvcHandler in the Application_EndRequest in the Global.asax.

    If you want to iterate yourself over the Routes you can do something like this:

    if(this.Context.Handler == null)
    {
                foreach (var route in RouteTable.Routes)
                {
                    var foundRoute = route.GetRouteData(new HttpContextWrapper(Context));
                    if(foundRoute==null)
                        continue;    
    
                    if(foundRoute.RouteHandler is MvcRouteHandler)
                    {
                      // code
                      break;
                    }
                }
    }
    

    if I remember correctly foundRoute will be NULL if it does not match the context, but you should run this code and test it.

    FYI Ignored routes implement StopRouteHandler. MvcRoutees implement MvcRouteHandler. There are some other handlers such as PageRouteHandler and ResourceRouteHandler.

    Update:

    BTW, I would add a hash or some caching method, if you plan to use this search, so you don’t iterate over the routes every time.

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

Sidebar

Related Questions

I'm currently building an ASP.NET MVC project, with NHibernate as its persistance layer. For
I have implemented errors handling in ASP.NET MVC site in a way like suggests
I'm trying to update global javascript variables from ASP.NET code. What I've tried to
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
I have a WCF service in an ASP.NET AJAX app that is returning json.
we have an asp.net application, that makes heavy use of REST/json services through httpwebrequest
Possible Duplicates: [.NET] How do I disable a system device? Win32 API function to
I have an ASP.NET FormView within an updatepanel. I'm auto-saving the form by setting
Possible Duplicate: .NET Enumeration allows comma in the last field public enum SubPackageBackupModes {
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should

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.