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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:58:22+00:00 2026-05-26T21:58:22+00:00

I am working on an application surrounding sporting events. There are different types of

  • 0

I am working on an application surrounding sporting events. There are different types of events like a soccer tournament and a tennis tournament. Based on the type of tournament I want to have the requests proccessed by a different area. But the events and their tournament type is something that is configurable by users of the application and stored in the database.

Currrently I have this proof of concept:

public class SoccerTournamentAreaRegistration : AreaRegistration
{
    public override string AreaName
    {
        get
        {
            return "SoccerTournament";
        }
    }

    public override void RegisterArea(AreaRegistrationContext context)
    {
        var soccerTournaments = new string[] { "championsleague", "worldcup" };
        foreach (var tournament in soccerTournaments)
        {
            context.MapRoute(
                string.Format("SoccerTournament_default{0}", tournament),
                string.Format("{0}/{{controller}}/{{action}}/{{id}}", tournament),
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                new[] { "Mvc3AreaTest1.Areas.SoccerTournament.Controllers" }
                );
        }
    }
}

and it works only I want soccerTournaments to come from the database (not a problem) but I also want it to work ask soon as a new event/tournament type record is added to the database and that doesn’t work in this case.

How can I make the area selection dynamic instead of hard coded into routes?

  • 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-26T21:58:23+00:00Added an answer on May 26, 2026 at 9:58 pm

    Area registration only occurs at the application start, so any tournaments added after startup will not be captured until a re-start.

    To have a dynamic routing scheme for your tournaments, you must redefine your area route and add a RouteConstraint.

    Redefine your route as follows:

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "SoccerTournament_default",
            "{tournament}/{controller}/{action}/{id}", 
            new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            new { tournament = new MustBeTournamentName() },
            new string[] { "Mvc3AreaTest1.Areas.SoccerTournament.Controllers" }
        );
    }
    

    Than, you can create the MustBeTournamentName RouteConstraint to be similar to the RouteConstraint in the answer to this question: Asp.Net Custom Routing and custom routing and add category before controller

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

Sidebar

Related Questions

We want to split a working application in two different .war files in order
I'm working on an application where users have to make a call and type
I am new to Jsp, and My working application is based on Struts1.3 .
I have a working WPF application. I would like to see it running as
i am working on application for events listing , the application get the events
I have a working web application that uses username/password SpringSecurity configuration. Now I want
I'm working on application which has workflow like this: 1.parsing home page (using HttpURLConnection,
I have a small working application in ASP.NET and C#, and I would like
I am working on application which stores event using EKEvent class and I want
I'm working on application where I want show popover in - (void)applicationWillEnterForeground:(UIApplication *)application app

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.