Taras Kovalenko Taras Kovalenko - 4 months ago 35
HTML Question

web api start html page

I have web api project and I have *.html page and I need run it after run my project but I don't know how do it.
In MVC I use MapRoute like this:

name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

But I don't know how do it in web api. I have next routes config:

config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{action}/{id}", new { id = RouteParameter.Optional });

and how to add other config for run my html page?


I use Like this code into the WebApi project:

public class DefaultController : ApiController
        /// <summary>
        /// Default controller for render swagger UI 
        /// </summary>
        /// <returns></returns>
        [HttpGet, Route("")]
        public RedirectResult Index()
            var requestUri = Request.RequestUri;
            return Redirect(requestUri.AbsoluteUri + "swagger/ui/index");