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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:31:10+00:00 2026-06-12T09:31:10+00:00

Generally we have following sample code in our global.asax file. So, my question is

  • 0

Generally we have following sample code in our global.asax file. So, my question is how we can have multiple MapRoute and how to use them ???

I want URL like:


http://domain/Home.aspx/Index/Cricket-Ball/12

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

I want something like this, but i don’t understand how to use this routing so that i can get SEO Friendly URL:


        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default1",
                "{controller}/{action}/{productname}/{id}",
                new { controller = "Home", action = "Index", productname = UrlParameter.Optional, id = UrlParameter.Optional }
            );

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

Thanks in advance.

  • 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-06-12T09:31:16+00:00Added an answer on June 12, 2026 at 9:31 am

    Since that’s not a generic url but a concrete one (pointing to a product), you could use:

    public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
            routes.MapRoute(
                "Products",
                "home/index/{productname}/{id}",
                new { controller = "Home", action = "Index" }
            );
    
            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    

    So, everything not matching to “Products” route will go to “Default”. Note that I didn’t add the “.aspx” to the rout since I believe it’s a mistake. If you actually want it, just add it to the route:

    routes.MapRoute(
                "Products",
                "home/index.aspx/{productname}/{id}",
                new { controller = "Home", action = "Index" }
            );
    

    Also, I would suggest to use a better url with:

    routes.MapRoute(
                "Products",
                "products/{productname}/{id}",
                new { controller = "Home", action = "Index" }
            );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My domain classes that have one-to-many mappings generally take the following form (untested code):
I have a general OOP question. If I have the following classes in C#
Hallo, i have following line of code: InputStream passoloExportFileInputStream = getClass().getClassLoader().getResourceAsStream(/com/thinkplexx/lang/de/general.xml); and i know
I have the following code in an equals method. public boolean equals(Object o){ if
I have the following definition at the top of my .ASCX file: <%@ Control
Let's say I have the following code: $(function () { $(.buy-it-now.ribbon).click(function () { $(.bid-to-beat.ribbon.active).removeClass(active);
I have a Java code with the following pattern: enum Foo { ORANGE, APPLE,
I have 2 doubts regarding basics of pointers usage. With the following code int
I have the following java code: nameFinderModel = NameFinderME.train(en, organization, sampleStream, Collections.<String, Object>emptyMap()); And
I have the following block of code in a jQTouch app I'm working on:

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.