Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Reply
Multiple [HttpPost] in one controller (Web api asp.net)
Dipika
7 years ago
784
Reply
Hi,
I have an controller in which i have defined multiple [HttpPost] methods and also given the [ActionName] to each method. But its not working even after updating the
Error - No action was found on the controller 'ControllerName' that matches the request.
WebApiConfig
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { Id = RouteParameter.Optional }
);
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
}
RouteConfig
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new {id = UrlParameter.Optional }
);
}
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
redirect to controller from global.asax when session End MVC
open Tiff document in browser?