skip to Main Content

Hi there currently I have a default.aspx file that I am trying to have show up when my domain is searched.

So far i’ve checked stackoverflow and have been given this general solution.

<system.webServer>
    <defaultDocument enabled="true">
      <files>
        <clear />
        <add value="default.aspx" />
      </files>
    </defaultDocument>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>

This has gotten me nowhere. I also tried the default settings that get given aswell which show default.aspx as a Default Document in the Default Documents section here

All of these solutions kept showing the 404 not found page.

Here is a screenshot of my bindings
404 URL: https://ro-aviation.com

2

Answers


  1. Chosen as BEST ANSWER

    Turns out I needed to add a redirect inside in my Global.asax file as I have done below.

    File: Global.asax

        public class Global : HttpApplication {
            void Application_Start(object sender, EventArgs e) {
                // Code that runs on application startup
               AreaRegistration.RegisterAllAreas();
               RouteConfig.RegisterRoutes(RouteTable.Routes);
            }
            void Application_BeginRequest(object sender, EventArgs e) {
                if (Request.AppRelativeCurrentExecutionFilePath == "~/") {
                    HttpContext.Current.RewritePath("default.aspx");
                }
            }
        }
    

  2. Do you mean you have a single file (Default.aspx) or you have a Asp.Net Web Forms project?

    You will not be able to host the single Default.aspx file directly in the IIS. If you do so, you will receive errors upon visiting the page in the browser.

    enter image description here

    First, you need to publish your Asp.Net Web Forms project from the Visual Studio.

    enter image description here

    Then you need to attach that published site folder with the IIS site in the IIS.

    enter image description here

    Then you need to create bindings for your site.

    enter image description here

    If you do above 2 steps properly then when you visit your site, the Default.aspx page will get disaplayed.

    As it is default page, you do not need to configure anything special.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search