在vb.Net web-project中设置默认网页

时间:2015-05-20 10:05:12

标签: vb.net default webpage web-project

我的网络项目中有一个类api和一个功能测试。要调用此函数,请在浏览器中键入链​​接http://localhost/api/test。现在我的问题是可以调用默认页面,例如index.html,如果我只调用没有像http://localhost/api这样的函数的类?

"我没有使用ASP.Net"

1 个答案:

答案 0 :(得分:0)

我在web.config文件中使用以下代码重定向解决了这个问题。

<configuration>
   <system.webServer>
      <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
         <add wildcard="*api" destination="/index.htm" />
         <add wildcard="*api/" destination="/index.htm" />
      </httpRedirect>
   </system.webServer>
</configuration>