链接到应用程序外部的文件

时间:2012-09-25 14:39:33

标签: asp.net web-applications iis-7 web web-config

我有一个包含3个应用程序的网站。在网站根目录中有3个文件夹(每个文件夹包含一个asp.net应用程序)和一个名为index.html的文件,其中包含3个链接:

<a href="Linea1/Pages/Sintesi.aspx"> Linea 1 </a> <br />
<a href="Linea2/Pages/Sintesi.aspx"> Linea 2 </a> <br />
<a href="Linea3/Pages/Sintesi.aspx"> Linea 3 </a> <br />

在每个应用程序的webconfig中都有一个类似的appSettings值:

<add key="linkPaginaHome" value="Index.html" />

在三个应用程序的每个页面中都有一个链接,并且他的href值是从web.config中获取的。 换句话说,我希望允许您从站点的每个应用程序转到index.html页面,并且此参数必须是可配置的。

我应该在webconfig值中写什么来使它指向index.html文件?

2 个答案:

答案 0 :(得分:0)

您可以添加此配置

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <add value="Index.html" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration>

链接:http://www.iis.net/configreference/system.webserver/defaultdocument

答案 1 :(得分:0)

我只是使用了完整的网址:

http://localhost:2012/Index.html

而不是只写

Index.html