No type was found that matches the controller named ‘User’

In my case, the controller was defined as: public class DocumentAPI : ApiController { } Changing it to the following worked! public class DocumentAPIController : ApiController { } The class name has to end with Controller! Edit: As @Corey Alix has suggested, please make sure that the controller has a public access modifier; non-public controllers … Read more

ASP.NET MVC – Extract parameter of an URL

Update RouteData.Values[“id”] + Request.Url.Query Will match all your examples It is not entirely clear what you are trying to achieve. MVC passes URL parameters for you through model binding. public class CustomerController : Controller { public ActionResult Edit(int id) { int customerId = id //the id in the URL return View(); } } public class … Read more

How to use an Area in ASP.NET Core

In order to include an Area in an ASP.NET Core app, first we need to include a conventional route in the Startup.cs file (It’s best to place it before any non-area route): In Startup.cs/Configure method: app.UseMvc(routes => { routes.MapRoute(“areaRoute”, “{area:exists}/{controller=Admin}/{action=Index}/{id?}”); routes.MapRoute( name: “default”, template: “{controller=Home}/{action=Index}/{id?}”); }); Then make a folder named Areas in the app … Read more

Difference between “MapHttpRoute” and “MapRoute”?

If you use Web API on top of ASP.NET they would ultimately both operate on the same underlying ASP.NET route table – however as correctly pointed out, from the user perspective you call two different methods to register route. Routing was designed like this so that when hosting outside of ASP.NET, Web API wouldn’t have … Read more