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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:36:35+00:00 2026-05-24T13:36:35+00:00

I use asp.net 4 and web forms in c#. I would like to know

  • 0

I use asp.net 4 and web forms in c#.

I would like to know how to Extends a RouteCollection Class for Web Form routing.

As MSDN state RouteCollectionExtensions Class is avaialbe only for MVC routing.
So I would like to know how an equivalent in Web Forms.

Thanks

  • 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-24T13:36:35+00:00Added an answer on May 24, 2026 at 1:36 pm

    ASP.NET Routing is available for webforms in .NET 4, and 3.5 I think.

    There is guidance on MSDN. http://msdn.microsoft.com/en-us/library/cc668201.aspx

    The webforms example requires you to add the following in global.asax

    protected void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes(RouteTable.Routes);
    }
    
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("",
           "Category/{action}/{categoryName}",
           "~/categoriespage.aspx");
    }
    

    The RouteCollectionExtensions type provides extension methods which extend RouteCollection for the MVC framework, you can create your own extension methods to extend RouteCollection.

    Simple example below, i’m sure you will want to put MyRouteCollectionExtensions somewhere else.

    using System;
    using System.Web.Routing; 
    
    namespace WebFormsExtension 
    {
        public class Global : System.Web.HttpApplication
        {
    
            void Application_Start(object sender, EventArgs e)
            {
                RegisterRoutes(RouteTable.Routes);
            }
    
            public static void RegisterRoutes(RouteCollection routes) 
            {
                routes.MapCustomRoute("SampleRoute/{name}"); 
            }
    
        }
    
        public static class MyRouteCollectionExtensions
        {
            public static void MapCustomRoute(this RouteCollection routes, string url)
            {
                PageRouteHandler handler = new PageRouteHandler("~/default.aspx");
                Route myRoute = new Route(url, handler);    
                routes.Add(myRoute);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would really like use the jQuery Validation plugin in my ASP.NET Web Forms
Im familiar with asp.net web forms. I would now like to move on to
I'm trying to use SWFUpload with an ASP.NET Web Forms project. I need to
When building a multi-lingual website (with ASP.NET web forms), I'll use an HTTP module
I use asp.net and c# in web forms. Using Visual Studio it creates automatically
I am using web forms, C#, Asp.net. As we all know, in this model
I use the ASP.NET Development Web server (also known as the Visual Studio Development
I use ASP.NET and WCF services in a load balanced web server environment, using
I need my ASP.NET web application to use silverlight controls in my web page.
I create new ASP.NET web application that use SMTP to send message. The problem

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.