0

I have a class api, and a function test in my web-project. To call this function, I type the link http://localhost/api/test in my browser. Now my question is it possible to call a default page, for example index.html, if i just call the class without the function like: http://localhost/api ?

"I doesn't use ASP.Net"

Janimal
  • 21
  • 6
  • http://stackoverflow.com/questions/1125280/setting-the-default-page-for-asp-net-visual-studio-server-configuration See the second solution--just right click on the file that you want to be the default and select "Set as Start Page" – Tony Hinkle May 20 '15 at 10:09
  • Thanks for reply. This Solution just work for the Server in Visual Studio but i will use it on an external IIS. – Janimal May 20 '15 at 10:30
  • The IIS settings have a default page configuration. See https://technet.microsoft.com/en-us/library/cc753615%28v=ws.10%29.aspx – Tony Hinkle May 20 '15 at 10:31
  • I tried this already, but it doesn't work for me. I think the reason is, that the Index.html is in the application folder, but the site has to stay there. – Janimal May 20 '15 at 10:39

1 Answers1

0

I solved the problem with a redirect with the following code in my web.config file.

<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>
Janimal
  • 21
  • 6