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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:16:37+00:00 2026-05-23T15:16:37+00:00

I want to create a route that redirects all requests matching certain pattern to

  • 0

I want to create a route that redirects all requests matching certain pattern to a location built using parts of the pattern. I want to grab some segment in the URL and treat the rest like a path to an aspx page in Web Forms application. For example

RouteTable.Routes.MapPageRoute("SomeRouteName", "{something}/{*path}", "~/pages/{*path}/Default.aspx");

Where *path could be something contain “\”. The query string should be preserved as a query string.

Is it possible to create souch a route?

  • 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-23T15:16:37+00:00Added an answer on May 23, 2026 at 3:16 pm

    After looking at several ways to do this I ended up creating my own routing handler that is something like this:

    public class SomethingRoutingHandler : IRouteHandler
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            string something = (string)requestContext.RouteData.Values["something"];
            string path = (string)requestContext.RouteData.Values["path"];
    
            string virtualPath = "~/" + path + "Default.aspx";
    
            return BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(Page)) as Page;
        }
    }
    

    I then use the RouteData in the pages to access something. I found these articles helpful:

    http://msdn.microsoft.com/en-us/magazine/dd347546.aspx

    http://www.xdevsoftware.com/blog/post/Default-Route-in-ASPNET-4-URL-Routing.aspx

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

Sidebar

Related Questions

I am trying to create a route and a action that redirects the params.
I don't want to use the default route that vs.net creates: routes.MapRoute( Default, //
I want to create a route like //Widgets/PerformanceTable/['best' or 'worst' to sort by performance
I want to use URL such as /Image/sample.png I create route, but it does
I make a carpooling application. When I want to create a new Route, I
I am trying ebook reading app. In that I want create UIActionSheet by clicking
I have a Query resource that I want to route to the root of
So I want to create a Zend_Controller_Router_Route_Hostname that matches the following: example.com www.example.com stage.example.com
How can you create a route that accept an undefined number of strings? The
I'm trying to create a Route in Cakephp that can have anything as a

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.