attributerouting Questions

6

I'm relatively new to the MVC framework but I do have a functioning Web Project with an API controller that utilizes AttributeRouting (NuGet package) - however, I'm starting another project and it ...
Workbag asked 5/6, 2013 at 16:18

3

Solved

I understand that RoutePrefix doesn't add a route to the routing table by itself. On your actions you need to have a Route attribute declared. I am having a hard time finding an authoritative blog/...

2

Solved

In ASP.NET Core (v 2.1.5) you can create controllers without having them inherit from Controller class (as you know). And if you do, you have to use RouteAttribute to define your routes. But, I'm i...

3

Solved

I am working on a small ASP.NET MVC project at the moment. The project was released a few month ago. But changes should be implemented for usability and SEO reasons now. I decided to use attribute ...
Rai asked 21/9, 2016 at 16:16

4

Solved

I'm creating a new webapi using attribute routing to create a nested route as so: // PUT: api/Channels/5/Messages [ResponseType(typeof(void))] [Route("api/channels/{id}/messages")] public asyn...

2

Solved

I am experiencing an issue with a refactoring of our payment processing action method (called by our 3rd-party online payment provider). We have a product controller with the [Authorize] and [Route...
Anorthic asked 1/3, 2015 at 23:39

3

Solved

I always used this approach in my MVC applications before [Route("admin")] public class AdminController : Controller { } [Route("products")] public class ProductsAdminController :AdminController...
Pridemore asked 14/9, 2018 at 15:46

3

Solved

Is it possible to separate GETs and POSTs into separate API Controller types and accessing them using the same Route Prefix? Here are my controllers: [RoutePrefix("api/Books")] public cla...
Abreaction asked 15/4, 2014 at 21:9

2

Solved

I am using areas in my ASP.NET Core 3.1 application (MVC). Now I want all requests without an explicit area to go to the "Main" area by default. This is how I currently set up my endpoint...
Procession asked 2/3, 2020 at 8:5

4

Solved

I know you can apply a wildcard in the route attribute to allow / such as date input for example: [Route("orders/{*orderdate}")] The problem with wildcard is only applicable to the last paramter...

2

Solved

I am trying to change this convention based route: routes.MapRoute( "MovieByReleaseDate", "movies/released/{year}/{month}", new { controller = "Movies", action = "ByReleasedDate" }, ); to att...
Superfine asked 15/5, 2018 at 17:1

1

Solved

As pointed out here, having a double slash in a URL is valid. I have an ASP Net Core project that uses attribute routing, a controller named GroupController for handling operations on Groups and a...

2

This is what my controller looks like: [Route("api/[controller]")] [Produces("application/json")] public class ClientsController : Controller { private readonly IDataService _clients; public Cl...

1

I am trying to enforce a route parameter to be guid but getting below error "Exception while executing function: GetUser -> One or more errors occurred. -> Exception binding parameter 'req' -> ...
Psychopathist asked 14/10, 2017 at 9:52

8

Solved

I'm using System.Web.Http.RouteAttribute and System.Web.Http.RoutePrefixAttribute to enable cleaner URLs for my Web API 2 application. For most of my requests, I can use routing (eg. Controller/par...

5

How does one set the default controller to use when using AttributeRouting instead of the default RouteConfiguration that WebAPI uses. i.e. get rid of the commented code section since this is redun...
Descender asked 28/4, 2013 at 17:29

2

Solved

I'm getting an attribute routing error with MVC 5.2. The error is Multiple controller types were found that match the URL. This can happen if attribute routes on multiple controllers match the req...
Gallice asked 7/11, 2014 at 17:7

3

Solved

...guess I'm the first to ask about this one? Say you have the following routes, each declared on a different controller: [HttpGet, Route("sign-up/register", Order = 1)] [HttpGet, Route("sign-up/...

3

I've configured my ASP.NET MVC5 application to use AttributeRouting for WebApi: public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.MapHttpAttribut...

3

Solved

I cannot get @Url.Action to resolve to the url I am expecting based on the attribute route I have applied: My action (SearchController but with [RoutePrefix("add")]) [Route("{searchTerm}/page/{p...

4

Solved

I want to reach the Bikes controller with these URL's: /bikes // (default path for US) /ca/bikes // (path for Canada) One way of achieving that is using multiple Route Attributes per Action: [R...
Stalinabad asked 25/6, 2015 at 14:49

5

Solved

I have a webapi project with a base ApiController named SlashBaseService: [RouteArea("uBase")] public abstract class SlashBaseService : ApiController { } The resulting dll is used in a WebForms ...
Barram asked 8/7, 2012 at 15:59

4

Solved

Similar to this question, but for the new ASP.NET Core. I can override an action's routing name: [ActionName("Bar")] public IActionResult Foo() { Can I do that for a controller, using attribute...
Jalisajalisco asked 20/2, 2017 at 18:10

2

Solved

I am new to attribute routing, and I am not sure if this is even possible. I have an attribute route, which works fine like this: [HttpGet] [Route("GetIssuesByFlag/{flag:int=3}")] public ...

2

Solved

I was wondering that if we use RoutePrefix attribute in our web api controller with a different name from controller's actual name. So would it work or not? As far as i did [RouterPrefix("quota...

© 2022 - 2024 — McMap. All rights reserved.