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 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 had the impression that there was a paper or article somewhere that claimed
There was a recent article that Linux kernel 3.3 has integrated Android as one
EDIT: I found an article that lists exactly what I needed: http://msdn.microsoft.com/en-us/library/ms646309(v=vs.85).aspx Thanks for
I am new to Liferay , is there any good article available for Creating
Is there any open source engine project which can classify online text or article.
Reading through the Wikipedia article on First-Class functions, there is a nice table of
I found this older article how-to-monitor-the-computers-cpu-memory-and-disk-usage-in-java and wated to ask, if there is something
Take the following article for example: http://weblogs.asp.net/psteele/archive/2009/11/23/use-dependency-injection-to-simplify-application-settings.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+dotnetmvp+%28Patrick+Steele%27s+.NET+Blog%29 I don't see what benefit there is
I installed haml-mode in my Emacs follow this article http://www.emacswiki.org/emacs/HamlMode There is my code
According to this Mozilla article on Ogg media , media works more seamlessly in

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.