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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:50:37+00:00 2026-05-26T04:50:37+00:00

I have an asp.net application where I need to have a general route for

  • 0

I have an asp.net application where I need to have a general route for given Medical Specialties to route to a given page except for one which I want to route to a different page.

For example I want /Specialties/Allergy, /Specialties/Nutrition to all route to a given page like they currently do. The part I can’t figure out is I want the URL to still show /Specialties/Urology but have urology rout to a different page because it is becoming essentially it own subsite where the other ones are not.

I’m sure I need to add a Route constraint but I can’t seem to figure out how to accomplish that.

I have include all of the relevant code I currently use for the general route.

private static void AddEntityRoute(string name, string url, string path, string dir)
{
((List<string>)HttpContext.Current.Application["RouteList"]).Add(url);

RouteTable.Routes.Add(name,
 new Route(url, new EntityRouteHandler(path, dir)));
}

public class EntityRouteHandler : IRouteHandler
{
    string _virtualPath;
    private readonly string baseDir;

    public EntityRouteHandler(string virtualPath, string baseDir)
    {
        _virtualPath = virtualPath;
        this.baseDir = baseDir;
    }

    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        var display = BuildManager.CreateInstanceFromVirtualPath(
                        _virtualPath, typeof (Page)) as IEntityDisplay;

        display.FriendlyURL = baseDir + requestContext.RouteData.Values["name"];
        return display;
    }
}

AddEntityRoute("Specialties", "Specialties/{name}", "~/SpecialtyDisplay.aspx", "/Specialties/");
  • 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-26T04:50:38+00:00Added an answer on May 26, 2026 at 4:50 am

    You’re approaching this the wrong way.

    If your intention is to direct a specific url to a different controller/action, then just add another route.

    routes.MapRoute("", "Specialties/Urology", new { controller = "someothercontroller", action = "someotheraction" });
    routes.MapRoute("", "Specialties/{speciality}", new { controller = "specialities", action = "show" });
    

    Here a request to “Specialities/Urology” would match the first route. A request to “Specialities/Allergy” would match the second.

    • 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 application for which I need to expose a particular subdirectory
I have an asp.net application where I need to pass values from one modal
In the ASP.Net application I am writing I need to be able to have
I have been developing an asp.net mvc application where i need to make large
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I have 6 servers that i need to deploy my ASP.NET web application to.
Retrofitting ASP.NET WebForms themes to an old application I have a need to theme
I am developing an application in asp.net mvc where i need to have Chat
I am using Asp.Net/C# in my application,I have a requirement where I need to
I have asp.net application. and I have created mobile version of it which is

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.