Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When publishing a web site, my default document name keeps getting removed from IIS

I have an ASP.NET web site project, which I'm publishing to IIS on my Win2k8 R2 server. It has a default page called login.aspx. I set that up on the published web site.

Trouble is, every time I publish a new version of the web site, the login.aspx entry gets erased from the "Default Document" settings of the web site in IIS. This is very annoying. How can I publish my web site from Visual Studio without wiping out the default page every time?

like image 386
Shaul Behr Avatar asked Nov 07 '10 08:11

Shaul Behr


People also ask

How do I enable default files in IIS?

Right-click the Web site, virtual folder, or folder whose default document settings you want to configure, and then click Properties. Click the Documents tab. Click to select the Enable Default Document check box. This turns on default document handling for the Web site, virtual folder, or folder that you selected.


1 Answers

Try putting a defaultDocument in your site's web.config:

<system.webServer>
    <!-- your other stuff -->

    <defaultDocument enabled="true">   
       <files>      
           <clear/>                 
           <add value="login.aspx"/>  
       </files>
    </defaultDocument>

</system.webServer>

like image 193
Benjamin Johnson Avatar answered Oct 31 '22 17:10

Benjamin Johnson