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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:26:38+00:00 2026-06-17T18:26:38+00:00

I have an MVC app and to populate the routes table there’s a method

  • 0

I have an MVC app and to populate the routes table there’s a method like this:

public static void RegisterRoutes(RouteCollection routes){
   routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    ....
   routes.MapRoute("default", "{controller}/{action}/{id}", new { controller = "Home", action = "index", id="" });
   ... etc
}

//and in global.asax it gets called like:
RegisterRoutes(RouteTable.Routes);

Now if I call that method from outside the MVC app (in some console app, just to get routes), I would pass a new empty collection, it will be populated with the routes used in the MVC app, but what’s use of it?
Can I based only on collection of routes, recognize the url for given controller name, action and other parameters? (again, from the outside of the web app)

  • 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-17T18:26:40+00:00Added an answer on June 17, 2026 at 6:26 pm

    I think routes[0].GetVirtualPath() is what you’re looking for. However, you’ll have to pass a RequestContext and RouteValueDictionary to it. If a route is not able to handle your input, it will return null

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

Sidebar

Related Questions

I have an ASP.Net-MVC app using LinqToSql. I have a subcontracts table, a service_lines
I have this markup in an MVC app. <div id=ingredientlistdiv> <% Recipe recipe =
I have an MVC app I'm writing. There will be the need for multiple
I have an MVC app which has a home controller with the method GetResult
I have an MVC app with custom membership and role providers. I am checking
I have a MVC app and using JQuery. I have anchor that I setup
I have an MVC app that does a lot of work with jQuery ajax
I have C# MVC web app that has some textboxes that in IE9 you
I have an ASP.NET MVC app and I want to add to each page
I have an MVC 1.0 app just setup but it only shows the Index.aspx

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.