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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:57:14+00:00 2026-05-16T13:57:14+00:00

I’ve got webform routing setup on my asp.net webforms 3.5sp1 project. I would like

  • 0

I’ve got webform routing setup on my asp.net webforms 3.5sp1 project. I would like to have the files for the site in a directory called content including the home page as I would like to run multiple sites using the same system.

In MVC there is a blank default page and the home page is in a folder called home. I can’t seem to replicate this behaviour using web form routing but would like to. The blank page is always hit first. the route handler is hit second – it recognises that the request is for the home page and sets up the routing page but is not used. the route handler code is simple:

    public string VirtualPath { get; private set; }

    public IHttpHandler GetHttpHandler(RequestContext
          requestContext)
    {
        string file = requestContext.RouteData.GetRequiredString("File");
        string id = requestContext.RouteData.GetRequiredString("Id");
        string queryString = "?menuid=" + id;
        VirtualPath = "~/" + file;
        HttpContext.Current.RewritePath(
          string.Concat(
          VirtualPath,
          queryString));

        var page = BuildManager.CreateInstanceFromVirtualPath
             (VirtualPath, typeof(Page)) as IHttpHandler;
        return page;
    }

Is there anyway I can do this?

Update
Here is my global.asax route code:

    public static void RegisterRoutes(RouteCollection routes)
    {
        Domain.RepositoryFactory repo = new RepositoryFactory();
        foreach (var x in repo.MenuRepository.GetAllEnabledGetMenus())
        {
            if (string.IsNullOrEmpty(x.Url))
            {
                //add default
                System.Web.Routing.RouteTable.Routes.Add(
                    new Route("Default.aspx", 
                        new RouteValueDictionary(new { File = x.FileName, 
                                                      Id = x.Id.ToString() }),
                              new CoreRouteHandler()));
            }
            else
            {
                string url = x.Url;
                if(x.Url.StartsWith("/"))
                {
                    url = url.Remove(0, 1);
                }
                System.Web.Routing.RouteTable.Routes.Add(
                    new System.Web.Routing.Route(url,
                        new RouteValueDictionary(new {File = x.FileName,
                                                      Id = x.Id.ToString()}),
                          new CoreRouteHandler()));
            }

        }

    }
  • 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-16T13:57:15+00:00Added an answer on May 16, 2026 at 1:57 pm

    ok I got it working bit of a doh! moment.

    I found this link while googling:

    http://blog.ysatech.com/post/2010/07/11/ASP-NET-4-URL-Routing-Default-Page.aspx

    all I needed to do was leave the route blank and delete the default.aspx file from the root of the site.

    I also copied in the default system.webserver bis from a new MVC project as i think what i had there wasn’t right. I’m upgrading an old project and so think it wasn’t configured 100%. specifically: was missing.

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

Sidebar

Related Questions

No related questions found

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.