Thursday, 25 August 2016

make MVC Web API available with method name and its parameters

Technology: MVC, WEB API , .NET


Steps:

  1. Open the web API solution.
  2. expand folder named "App_Start"
  3. Open file named "RouteConfig"


Replace below method:


  public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

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


No comments:

Post a Comment