how to set start page in webconfig file in asp.net c#

Bhupinder picture Bhupinder · Dec 4, 2013 · Viewed 119.9k times · Source

how to set start page using webconfig file .I have tried this code

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

But it didnot work for me . I have set start page by right click on page in solution explorer then choose option set as start page but how can i do it programmatically

Answer

user1719554 picture user1719554 · Jun 27, 2014

the following code worked fine for me. kindly check other setting in your web config

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