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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:59:30+00:00 2026-05-24T06:59:30+00:00

I have a Global.asax where I define routes (see RegisterRoutes method below) I will

  • 0

I have a Global.asax where I define routes (see RegisterRoutes method below)

I will have a lot of routes, so I would like keep this method in a separate static class, importing using a namespace in the Global Asax and use the method in the Application_Start.

Unfortunately I’m not able to do it.

So my question:

  • Can I use static class in Global.asax?
  • If yes, how can I do it?

    void RegisterRoutes(RouteCollection routes)
    {
        // Register a route for Categories/All
        routes.MapPageRoute(
                "All Categories",       // Route name
                "Categories/All",       // Route URL
                "~/AllCategories.aspx"   // Web page to handle route
            );
    
        // Register a route for Products/{ProductName}
        routes.MapPageRoute(
            "View Content",             // Route name
            "Content/{ContentId}",   // Route URL
            "~/Cms/FrontEndCms/Content.aspx"        // Web page to handle route
        );
    
    }
    
    protected void Application_Start(object sender, EventArgs e)
    {
        // ROUTING.
        RegisterRoutes(RouteTable.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-24T06:59:31+00:00Added an answer on May 24, 2026 at 6:59 am

    You should definitely be able to do this:

      protected void Application_Start(object sender, EventArgs e)
        {
            // ROUTING.
            Helper.RegisterRoutes(RouteTable.Routes);
        }
    
    
    public static class Helper
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            // Register a route for Categories/All
            routes.MapPageRoute(
                    "All Categories",       // Route name
                    "Categories/All",       // Route URL
                    "~/AllCategories.aspx"   // Web page to handle route
                );
    
            // Register a route for Products/{ProductName}
            routes.MapPageRoute(
                "View Content",             // Route name
                "Content/{ContentId}",   // Route URL
                "~/Cms/FrontEndCms/Content.aspx"        // Web page to handle route
            );
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have registered a component like this in my Global.asax.cs: ContainerBuilder builder = new
i defined two routes in global.asax like below context.MapRoute(HomeRedirect, , new { controller =
I have the Global.asax like the code below: public class MvcApplication : System.Web.HttpApplication {
I have defined a series of Routes in Global.asax.cs: public static void RegisterRoutes(RouteCollection routes)
I have an Application Object. In Global.asax file i use this: Application[obj] = test;
I have a client who has one webpage with customized routes added in global.asax
I experience strange problem. We have error handling in global.asax that would redirect user
In Actionscript you can have global variables like this: var number : Number =
I have the following routes defined in my Global.asax: routes.MapRoute(name: Home, url: , defaults:
I have the following Route defined in Global.asax: routes.MapRoute( IncidentActionWithId, // Route name Incidents/{companyId}/{action}/{id},

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.