【问题标题】:ASP.NET Default DocumentASP.NET 默认文档
【发布时间】:2011-01-01 23:50:32
【问题描述】:

我有 default.aspx 和 index.html。我将两者都上传到服务器,但我希望我的第一页以 index.html 开头。我该怎么办?

【问题讨论】:

    标签: asp.net html hosting web-hosting


    【解决方案1】:

    如果您无权访问 IIS,并且您托管在 IIS 7 (Windows Server 2008) 上,您可能希望将其放入您的 web.config 文件中:

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

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

    【讨论】:

    • 这是正确的解决方案,但要注意是否复制并粘贴它。 &lt;clear/&gt; 标签中的/&gt; 之间有一个空格。由于它少于六个字符的修复,我无法对其进行编辑。
    【解决方案2】:

    您需要在托管 ASP.NET 应用程序的虚拟目录的属性中对其进行配置。将index.html 放在default.aspx 之前


    (来源:plus2net.com

    【讨论】:

      【解决方案3】:

      您需要更改默认文档列表的顺序以将 index.htm 置于顶部,在 IIS6 上,可在 IIS 管理器站点的“属性”对话框的“文档”选项卡上找到。

      【讨论】:

        【解决方案4】:

        您需要在 IIS 中进行设置。在 IIS 管理器中,这将位于 Documents 选项卡下。

        【讨论】:

          【解决方案5】:

          如果您无权访问 IIS,请在您的 default.aspx 页面中将其写入您的代码后面。

          Response.Redirect("index.htm");
          

          【讨论】:

            猜你喜欢
            • 2015-10-14
            • 1970-01-01
            • 2017-09-14
            • 2012-09-15
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多