In this article I will explain with an example, how to Set
default page for your website in
IIS using
Web.Config file in
ASP.Net.
First you need to look for
in your Web.Config file, if it is missing then you will need to add it. After that you need to add the section as shown below. And within it between the section you can add either single page or multiple pages.
Single Default Page
<defaultDocument enabled="true">
<files>
<clear/>
<add value="Home.aspx"/>
</files>
</defaultDocument>
Multiple Default Pages
Here if the Home.aspx page is missing the 2nd page i.e. Contact.aspx will become the Default page.
<defaultDocument enabled="true">
<files>
<clear/>
<add value="Home.aspx"/>
<add value="Contact.aspx"/>
</files>
</defaultDocument>
Note: Above will not work in
Visual Studio Localhost Web Server, thus if you want to set a default page in
Visual Studio you need to do as shown in the screenshot below.
Downloads