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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:39:24+00:00 2026-05-24T15:39:24+00:00

I am using a third party nuget called AttributeRouting which registeres routes using attributes.

  • 0

I am using a third party nuget called AttributeRouting which registeres routes using attributes. I have a unique situation and i need to remove a route from the route table on Application_Start or similar. How can this be done?

I have supplied a screenshot of the route i want to remove. I have even named it “RemoveMePlease”.
enter image description here

thanks

  • 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-24T15:39:25+00:00Added an answer on May 24, 2026 at 3:39 pm
    public class MvcApplication : admin.project.Global
    {
        protected override void Application_Start()
        {
            base.Application_Start();
    
            int iRoute = 0;
            while (iRoute < RouteTable.Routes.Count)
            {
                bool isLastRoute = (iRoute == (RouteTable.Routes.Count - 1));
    
                RouteBase route = RouteTable.Routes[iRoute];
    
                if (!isLastRoute && route is AttributeRoute)
                {
                    AttributeRoute currentRoute = route as AttributeRoute;
                    int maxRouteIndex = RouteTable.Routes.Count - 1;
                    for (int iDup = maxRouteIndex; iDup >= (iRoute + 1); iDup--)
                    {
                        if (RouteTable.Routes[iDup] is AttributeRoute)
                        {
                            var potentialDupRoute = RouteTable.Routes[iDup] as AttributeRoute;
    
                            if (currentRoute.Url.Equals(potentialDupRoute.Url)) //-- routes match on url
                            {
                                //-- do httpMethods also match?
                                //-- AttributeRouting <=3.1
                                ICollection<string> currentHttpMethods = ((currentRoute.Constraints["httpMethod"]) as HttpMethodConstraint).AllowedMethods;
                                ICollection<string> potentialHttpMethods = ((potentialDupRoute.Constraints["httpMethod"]) as HttpMethodConstraint).AllowedMethods;
    
                                //-- AttributeRouting > 3.1
                                ICollection<string> currentHttpMethods = (currentRoute.Constraints["inboundHttpMethod"] as AttributeRouting.Web.Mvc.Constraints.InboundHttpMethodConstraint).AllowedMethods;
                                ICollection<string> potentialHttpMethods = (potentialDupRoute.Constraints["inboundHttpMethod"] as AttributeRouting.Web.Mvc.Constraints.InboundHttpMethodConstraint).AllowedMethods;
    
    
                                IEnumerable<string> matchedHttpMethods = currentHttpMethods.Intersect(potentialHttpMethods);
    
                                //-- remove the route
                                if (matchedHttpMethods.Count() == currentHttpMethods.Count()) RouteTable.Routes.Remove(currentRoute);
                            }
                        }
                    }
                }
    
                iRoute++;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This
I have application building using third party apis, j2me apis,application code distributed in various
I have a program that i compiled and ran using third party lib on
I am using a third party tool which internally adds trace messages using the
I have a simple player i am using third party libraries. Exactly the same
I am using a third party java library which spawns new JFrame windows. How
we are using some third-party library that have some dependencies that must be referenced
I'm using third party library which compiled one week ago. Today I sat down
When using third-party libraries such as jquery, yui-reset, swfobject and so on, do you
What is the simplest way (preferably without using third party frameworks) in objective c,

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.