We help IT Professionals succeed at work.

Web Forms Project -  Index Page In Subfolder

Background:
The project is an ASP.NET Web Forms site.  
It is currently in the process of attempting to support a hybrid MVC model.  
The new index page now resides in a subfolder.  

Question: I was wondering if its possible to add a route to the RouteCollection in order to use the index in the sub folder as the landing page?  I realize "Default Document" is an IIS setting but was wondering if there was a way to over ride this.  I'm trying to avoid making the index an HTTPRedirect/JS Redirect/Response.Redirect.

www.mysite.com --> ~/Account/Index.aspx
instead of
www.mysite.com --> Index.aspx

I have tried the following with no success:

Using System.Web.Routing
protected void Application_Start(object sender, EventArgs e)  {

// routeCollection.MapPageRoute("Default", "", "~/Account/Index.aspx");
// routeCollection.Add("Default", new Route(string.Empty, new PageRouteHandler("~/Account/Index.aspx")));
}

Open in new window

Comment
Watch Question

Distinguished Expert 2019
Commented:
you can't override iis especially for the default document without using a redirect as mvc doesn't have control yet