Friday, 23 October 2015

Default document in web.config.

So why exactly we need to provide the default document
when you type the website name then the first page should come by default.

 www.mysite.com should provide you with login page of the default aspx document, so to provide this following is the process.


The web.config file can be used to set a default document, or list of default documents for your website. Web.config can be used to change the default document (page) for an entire site, or on a directory by directory basis. The default page may be any file.

 I had the system.web option already so I had to use this option.

<?xml version="1.0"?>
<configuration>
   <system.web>
     .. existing text ..
     .. existing text ..
   </system.web>
   <system.webServer>
      <defaultDocument enabled="true">    <!-- this line enables default documents for a directory -->
         <files>      
            <clear/>     <!-- removes the existing default document list -->                
            <add value="Login.aspx"/>     <!-- foo.htm is now the default document  -->                
           
         </files>
      </defaultDocument>
      <modules runAllManagedModulesForAllRequests="true"/>
   </system.webServer>
</configuration>

Refer to this site for more details

http://www.stokia.com/support/misc/web-config-default-website-document.aspx

No comments:

Post a Comment