4

Possible Duplicate:
MVC 4 WebAPI controllers splitted by Areas

This relates to this question and answer: How to create ASP.Net MVC Web API Url?

I have a fresh, new MVC project with everything still as generated by the project template, except for one new Area called Admin. In this area I have ClientApiController and ClientController, and in view Client/Index I am trying a URL as described in the answer I link to, with the extra 'area' value.

@Url.RouteUrl("DefaultApi", new { httproute = "", area = "Admin", controller = "Client" })

However, the area part isn't working and I still get 'resource not found'. What am I doing wrong?

Community
  • 1
  • 1
ProfK
  • 49,207
  • 121
  • 399
  • 775
  • 1
    I recommend the Route Debugger for debugging such issues: http://nuget.org/packages/routedebugger – sinelaw Apr 24 '12 at 14:25

1 Answers1

3

I think you should have

@Url.RouteUrl("DefaultApi", new { httproute = "", area = "Admin", controller = "ClientApi" })

ClientApi

Alexander Beletsky
  • 19,453
  • 9
  • 63
  • 86