简体   繁体   English

asp.net中如何将主页设为默认页

[英]How to make home page as default page in asp.net

How can i set default home page in asp web.config file.如何在 asp web.config文件中设置默认主页。
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 .当我键入www.example.com时,它说目录列表已禁用,但不会重定向到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我不想启用目录列表,但如果有人键入www.example.com ,他应该被发送到www.example.com/Home.aspx

Change in your webconfig for iis 7.更改 iis 的 webconfig 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查看此帖子: 在 Asp.net 中设置默认页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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