简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM