ASP.NET Default Document

2019-02-28 10:38发布

i have default.aspx and index.html. I uploaded both to the server, but i want my first page start with index.html. What should I do?

5条回答
走好不送
2楼-- · 2019-02-28 11:09

in your default.aspx page write this in your code behind if you don't have access to IIS.

Response.Redirect("index.htm");
查看更多
别忘想泡老子
3楼-- · 2019-02-28 11:12

You need to configure it in the properties of the virtual directory hosting the ASP.NET application. Put index.html before default.aspx

alt text http://www.plus2net.com/designs/images/default-iis.jpg

查看更多
唯我独甜
4楼-- · 2019-02-28 11:17

You need to change the order of default document list to bring index.htm to the top, on IIS6 this found on the Documents tab of Properties dialog on the site in IIS manager.

查看更多
【Aperson】
5楼-- · 2019-02-28 11:21

You need to set this up in IIS. In the IIS manager, this will be under the Documents tab.

查看更多
迷人小祖宗
6楼-- · 2019-02-28 11:22

If you do not have access to IIS, and you are hosted on IIS 7 (Windows Server 2008), you may want to put this into your web.config file:

<system.webServer>
    <defaultDocument>
        <files>
            <clear / >
            <add value="index.html" />
        </files>
    </defaultDocument>
</system.webServer>   

Source: How to add a default document with IIS7 web.config

查看更多
登录 后发表回答