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

AttributeRouting generate links with specified language

I would like to know if there is some way to using Html.ActionLink to set in which language has to be generated the URL of link using AttributeRouting. I have tried with: Html.ActionLink("DescriptionLinkText", "Controller", "Action", …
Marc Cals
  • 2,963
  • 4
  • 30
  • 48
0
votes
1 answer

unusual behavior with attribute routing

I am working with Attribute Routing and find it excellent. In particular the fact I can localize my routes in a number of different cultures. I have run in to a problem that is occurring irregularly - it occurs sometimes and not others and I can not…
amateur
  • 43,371
  • 65
  • 192
  • 320
0
votes
1 answer

Passing json string to MVC4 action method marked with POST Attribute (AttributeRouting)

I'm using AttributeRouting library to make rooting easier. I've a method marked with POST attribute and gets a string parameter as below. [POST("Create")] public ActionResult Create(string data) { JavaScriptResult result = new…
Halil Ibrahim
  • 1,339
  • 1
  • 20
  • 39
0
votes
1 answer

How can I catch all requests starts with /X in AttributeRouting

Urls: /X?take=1&skip=4 [GET("X/{request:alpha?}", IsAbsoluteUrl = true)] [GET("X{request:alpha?}", IsAbsoluteUrl = true)] [GET("X{request:alpha*}", IsAbsoluteUrl = true)] does not work.
Oguz Karadenizli
  • 3,449
  • 6
  • 38
  • 73
0
votes
0 answers

MVC AttributeRouting always gives 404 when I try using a string

I'm using this package which I installed from NuGet. I've got a method that looks like this: [GET("StreamFile/{filename}")] public FileStreamResult StreamImageByFileName(string filename) Which I reference like this:
mpen
  • 272,448
  • 266
  • 850
  • 1,236
0
votes
1 answer

Why links generated with @Url.Action in JavaScript are not in lowercase when using AttributeRouting?

I have this code in a JavaScript function: var url = '@Url.Action(MVC.Membership.User.ActionNames.Update, MVC.Membership.User.Name)'; url += "?userName=" + userName; ul.append("
  • " + userName + "
  • "); Membership is…
    -1
    votes
    1 answer

    Web Api Routing: Multiple controller types were found that match the URL for parameter VS constant paths

    My issue is similar to Web Api Routing : Multiple controller types were found that match the URL but I want to keep them in separate controllers. From the comments, 2 preexisting answers are good workarounds but do not solve the actual issue I'm…
    -1
    votes
    1 answer

    Is it possible to hardcode response in web api?

    I need to call a web service every 5 minutes which tells if the system down. The problem is if the server is down, the system does not call the controller. We are using attribute routing. If the server is down I need to create a hardcoded response…
    jelliaes
    • 485
    • 5
    • 18
    -1
    votes
    2 answers

    How to use attribute routing in one action?

    I need to routing to one action by attribute routing in mvc5 . My action : [Route("bus/{DepProvince}{From}/{DesProvince}-{To}/{DepartureDate}/{IsForeign}")] public ActionResult Index(int? DepProvince, int? From/*City*/, int? DesProvince,…
    hmahdavi
    • 2,250
    • 3
    • 38
    • 90
    -1
    votes
    1 answer

    ASP MVP Configuration NOT Convention

    I understand a lot of the benefits of the convention over configuration approach of ASP MVC. That said, I would like to attempt to build an ASP MVC-based site using an configuration-based a approach and with route attributes. Effectively, I'd like…
    frigon
    • 4,979
    • 7
    • 32
    • 38
    -1
    votes
    1 answer

    Controller method overloading using attribute routing

    I can change the method name but can anyone tell me why this doesn't work? How can i make it working without changing method name. Also I don't want to specify the action name in the view. Is it possible? [HttpGet] …
    Mir Gulam Sarwar
    • 2,588
    • 2
    • 25
    • 39
    1 2 3
    24
    25