How to make home page as default page in asp.net

j4m4l picture j4m4l · Apr 6, 2012 · Viewed 18.6k times · Source

How can i set default home page in asp web.config file.
i have already written this code :

<urlMappings>
  <add url="/" mappedUrl="Home.aspx"/>
  <add url="Default.aspx" mappedUrl="Home.aspx"/>
</urlMappings>     

and also tried this

<defaultDocument>
  <files>
    <add value="Home.aspx" />
  </files>
</defaultDocument>

but i guess its not working. when i type www.example.com it says directory listing is disabled, but does not redirect to www.example/Home.aspx.

I dont want to enable directory listing but if someone types www.example.com he should be send to www.example.com/Home.aspx

Answer

SMK picture SMK · Apr 6, 2012

Change in your webconfig for iis 7.

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

Take a look for this post :Set Default Page in Asp.net