Questions tagged [attributerouting]

Define your routes using attributes on action methods in ASP.NET MVC and Web API.

NOTE: Attribute Routing support is currently built into Web API. You can read more information about it here: http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2

371 questions
0
votes
1 answer

performance of Html.ActionLink and Url.Action

I have an asp.net mvc web application for a large scale application which is multi lingual supporting 15 different languages. I am using attribute routing to localize my routes as there is a requirement to localize the url's. This creates 2675…
amateur
  • 43,371
  • 65
  • 192
  • 320
0
votes
1 answer

AttributeRouting v3.5.6 prefixes and areas not being applied to routes

I've added Tim McCalls AttributeRouting v.3.5.6 via the NuGet package. It seems straight forward enough, but area names and routeprefixes are not being applied to the routes shown in routes.axd. Has anyone else experienced this?
Josh Wheelock
  • 369
  • 4
  • 9
0
votes
1 answer

MVC5 Attribute Route, emitting null for route without optional params

I have on the controller: [RoutePrefix("")] The action with route: [Route("things-to-do/{filter1?}/{filter2?}/{filter3?}/{filter4?}/{Area?}", Name = "thingstodo")] public async virtual Task ThingsToDo(string filter1 = "",…
0
votes
2 answers

Remove additional route parameters for POST submit

I have a route definition using the new MVC5 RouteAttribute that looks like this- [HttpGet] [AllowAnonymous, Route("Account/ResetPassword/{user}/{token}", Name = "ResetPasswordForm")] public async Task ResetPassword(int user, string…
pwdst
  • 13,909
  • 3
  • 34
  • 50
0
votes
1 answer

Attribute Routing Strange Behavior in ApiController

I'm using attribute routing to specify my routes in a controller that inherits from System.Web.Http.ApiController. I'm getting some funky behavior. Here's some sample code: [RoutePrefix("api/1/user")] public class UserRestController :…
Teeknow
  • 1,015
  • 2
  • 17
  • 39
0
votes
1 answer

ASP.NET MVC AttributeRouting doesn't generate any route

I installed AttributeRouting via nuget, for an ASP.NET MVC 4 project, in which previously I mapped routes lowercase with a MapRouteLowercase extension, but I don't really think this could be causing the problem, because when I disabled my older…
0
votes
1 answer

Attribute Routing changes WebAPI pipeline

I've got a .NET WebApi solution. I'm constraining access to HTTPS but conditionally allowing HTTP traffic. One of the conditions is that all HTTP requests must use the HTTP POST method, passing the x-http-method-override header to supply the…
0
votes
1 answer

(ASP MVC4) Attribute Routing / RedirectToRoute

I need a little help on what i'm trying to achieve. I'm doing an ASP MVC App and i can't make the routes properly. I'm using the nuget package Attribute Routing (which is now by default in MVC5). First I hadn't any issues using it all the routes…
dotdiego
  • 157
  • 3
  • 14
0
votes
1 answer

How to convert this fix this ASP.NET MVC5 route?

I'm not sure how to convert this AttributeRoute into an MVC5 route. [GET("", IsAbsoluteUrl = true)] // => main home page. [GET("Index")] public ActionResult Index(..) { .. } The IsAbsoluteUrl is one of the things that is confusing me.
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
0
votes
0 answers

MVC Web API Attribute Routing: Route Constraints Error

I am using the Attribute Routing for Web API nuget package. My RegisterRoutes(HttpCollection routes) method looks like this: public static void RegisterRoutes(HttpRouteCollection routes) { routes.MapHttpAttributeRoutes(config => { …
0
votes
1 answer

Multiple GET verb on single route with different parameter name Web Api

How can possible to call different-different action on basis of parameter name using single route. I need following /api/v1/user GET key=dfddg&secret=fafassaf&query=select id from user where user like '%ggg%' and…
Govind Malviya
  • 13,627
  • 17
  • 68
  • 94
0
votes
1 answer

Web API: AttributeRouting with typed parameter possible?

Is this possible? For example, [GET("api/item/{id}/related")] public dynamic GetRelatdItemsById(string id, Filter filter) { // get items related by id and optionally filter by `filter` } If this is possible, how should the…
alex
  • 614
  • 1
  • 6
  • 15
0
votes
1 answer

How do I get a default route on a controller using WebApi & Attribute Routing?

I'm using WebApi and attribute routing. I have a customer controller that has a method to get all the animals for that customer. This method & route work great. However, I also want a method that just returns a list of all the customers, and I can't…
taylonr
  • 10,732
  • 5
  • 37
  • 66
0
votes
1 answer

AttributeRouting mandatory parameter

Can I add mandatory parameter to all controller? I develop RESTful api, so I want to require special "apikey" parameter for every route. [HttpPut] [PUT("create")] public PostDto Create(string title, string description, string tag,…
FanAs
  • 199
  • 1
  • 11
0
votes
2 answers

How to translate query paramters using Attribute Routing in MVC website?

I have a HorseController with its Index method like: [GET("Index", TranslationKey = "HorseIndex")] [AllowAnonymous] public ActionResult Index(int? page, HorseTypes? type, HorseGenders? gender, HorseBreeds? breed, HorseJumps? jump, …
Cristian Boariu
  • 9,603
  • 14
  • 91
  • 162
1 2 3
24
25