How to set first page of website using web config in asp.net c#

As we know that every website has a default page or first page so in this article we learn how to set default page or first page of website using web config. All control take default page or first page is index.html so we need to go change in c-panel of hosting and where we can do. Now suppose if you are using FTP account then we do not have access of C-panel. Then we can set our first page or default page via our web config, it’s very easily



Single Default Page

<system.webServer>
<defaultDocument enabled="true">
 <files>


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

Multiple Default Pages
Here if the index.aspx page is missing the 2nd page i.e. home.aspx will become the First page.
<system.webServer>
<defaultDocument enabled="true">
 <files>
    <clear/>
    <add value="index.aspx"/>
    <add value="home.aspx"/>
 </files>
</defaultDocument>
</system.webServer>

Note: This feature is applicable for .Net 3.5, 4.0, 4.5 or above frameworks.





How to set first page of website using web config in asp.net c# How to set first page of website using web config in asp.net c# Reviewed by NEERAJ SRIVASTAVA on 6:38:00 PM Rating: 5

No comments:

Powered by Blogger.