How To Set Default Page In Asp.Net

For More Videos Visit Our YouTube Channel




Here we consider two cases.

1. When the project is run from Visual Studio.
2. When the project is run from IIS.
Lets consider them in detail.




If you are running a project using Visual Studio, this can be done as follows. Right Click on your desired Page and Select Set As Start Page.

How To Set Default Page In Asp.Net, Set Default Page In Asp.Net, How To Set Default Page, Set Start Page In Asp.Net Web Application, Set Default Page From IIS, Default Page From In Visual Studio, Start page In IIS, Asp.Net, Web.Config




But what if for Websites that are hosted on IIS. If there is Default.aspx, it would render first. If we need any other page instead of Default.aspx, we can follow below method. For that the best solution is to add following code on Web.Config.

<system.webServer>
  <defaultDocument>
    <files>
      <clear />
      <add value="MyPage.aspx" />
    </files>
  </defaultDocument>
</system.webServer>



The above code needs to be placed inside configuration node. In the place of Mypage.aspx, you can add your desired page.