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

  • Home
  • SEARCH
  • 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 341331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:41:58+00:00 2026-05-12T10:41:58+00:00

Is there an article somewhere explaining exactly how the route matching works and what

  • 0

Is there an article somewhere explaining exactly how the route matching works and what it is capable of?

For example, how would I write a route to catch everything, so that:

/
/something
/something/else
/something/else/again

all get mapped to the same controller action, with the URL passed as a parameter?

{*anything}

The above doesn’t seem to work. Can it not handle slashes inside arguments?

  • 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-12T10:41:58+00:00Added an answer on May 12, 2026 at 10:41 am

    The code below catches almost everything.

    http://www.mysite.com/
    

    for instance would still be routed to default.aspx,I think. But something like

    http://www.mysite.com/some/page/that/doesnt/exist

    would be caught by the TestRouteHandler. The {*fields} route specifier should wind up in the RequestContext.RouteData object passed to the router so you can do whatever you want. However, at that point, you’re basically implementing a rewrite engine.

    public class Routes
    {
        public static void Register(RouteCollection routes)
        {
            // setup legacy url routing
            routes.Add(new Route("{*fields}",new TestRouteHandler()));
        }
    }
    
    public class TestRouteHandler : IRouteHandler
    {
        public virtual IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            Page page = BuildManager.CreateInstanceFromVirtualPath("/default.aspx", typeof(Page)) as Page;
            return page;
        }
    
    }
    

    alternatively, you can specify a top-level route like

        routes.Add(new Route("dave/{*fields}",new TestRouteHandler()));
    

    which will catch items like.

    http://www.mysite.com/dave
    http://www.mysite.com/dave/test/parameter
    http://www.mysite.com/dave/virtually/infinite/number/of/items/goes/here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a blog style site and under each article there is the usual
Say there is an article on a site about sports Kobe Bryant is the
I am having problem understanding Priority Inversion Snippet from the article: Consider there is
There is this MSDN article about spcial characters in WPF/XAML : But those Things
I have two models - category and article. I have pretty much the same
Learning asp.net mvc and whenever I worked we had to localize our application. Looked
First, I'd like to apologize for adding to the myriad of questions on this
I am trying to send images and text from an iPhone application to a
How do we measure the 'high resource consuming' part? As a follow up, I
I'm trying to make myself a GUI library using plain WinAPI. But I found

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.