Questions tagged [asp.net-mvc-areas]

An organizational concept present in ASP.NET MVC, that allows the developer to partition a large web application into smaller units.

An organizational concept present in ASP.NET MVC, that allows the developer to partition a large web application into smaller, distinct units. Areas might be used to, for instance, divide an application into inventory, review, storefront, and administration modules.

More information

575 questions
14
votes
1 answer

Link to a root controller from area controller in ASP MVC

How can I link to one of my root controllers from one of my areas? <% Html.RenderAction("Action", "Page", new {area = "root", name = "Admin"}); %> This gives me an error: No route in the route table matches the supplied values. I have a…
13
votes
3 answers

ASP MVC Areas and ActionLink

I'm working on a new project where I want to use Phil Haack Areas (1) idea + Steve Sanderson's tweak (2). I have a simple root view with an action link to a view an area (Foo). The URL that is generated has the proper area, but it appends the root…
Joe
  • 565
  • 2
  • 4
  • 14
13
votes
2 answers

ASP.NET MVC 3 RC AreaRegistration.RegisterAllAreas() and dynamically loaded assemblies

I am currently experimenting with dynamically loaded areas with ASP.NET MVC 3 RC. I've seen it written in many places that this is not what areas are intended for, and (at least pre-MVC 2) not possible, say here for example. But still! It should be…
Robin
  • 555
  • 4
  • 14
13
votes
3 answers

web api 2 area routes

I am using asp.net mvc 5 and web api 2. For the asp.net mvc 5 project I have everything working... but new I am trying to add web api 2 routes... when I am using areas. I have the web api 2 controller working at the project root: //this is…
13
votes
2 answers

ASP.NET MVC routing and areas

I am messing around with ASP.NET MVC 2 Preview 2 and am trying to figure out how routing works with areas and such. In a single project implementation of areas, I want an area named "admin". I am trying to be able to have urls like…
Dan Appleyard
  • 7,405
  • 14
  • 49
  • 80
12
votes
2 answers

RedirectToAction outside of Areas

I've recently updated our MVC 2 project at work to use Areas however I'm having a little problem with the RedirectToAction method. We still have some of our controllers etc outside of our Areas. These controllers include the Home controller etc. How…
Jamie Dixon
  • 53,019
  • 19
  • 125
  • 162
12
votes
2 answers

What are the goals and benefits of using areas?

I have question about benefit of using areas and necessity of them. I see some opposites: MVC patterns have routes, and they need for escaping out of folder structure. But when we using areas we create folders which maps to routes. And result of…
testCoder
  • 7,155
  • 13
  • 56
  • 75
11
votes
1 answer

asp.net mvc area default page

I have a MVC 2 site with an area, let's say the area name is {Admin} The areas and the site works fine. What I am trying to do is to have different default page for the area. When I am calling http://webSiteName works with no problem but for…
profanis
  • 2,741
  • 3
  • 39
  • 49
11
votes
1 answer

Best Practices for Composed ASP.NET MVC Web Applications (MEF, Areas, DI)

I am currently figuring out how to restructure the architecture of an existing not very modular ASP.NET MVC 3.0 application. I have a plugin like structure in mind to make the existing project extensible. I have searched for different strategies to…
10
votes
1 answer

Styles, scripts and images in Area folder

I've setup an Admin area within MVC 3 application and while everything is working when I reference files from the root Scripts, Styles and Images folder, it doesn't work when I created those folders under /Areas/admin/ and referenced them like…
mare
  • 13,033
  • 24
  • 102
  • 191
10
votes
4 answers

An error occurred while creating a route

I try to add an area to my .NET Core project, but always I see that error: RouteCreationException: An error occurred while creating the route with name '(My Area Name)' My Code is : public void Configure(IApplicationBuilder app,…
A.J
  • 139
  • 1
  • 1
  • 10
10
votes
1 answer

ASP.NET MVC Default routes accessible via area routes

So far (for brevity) I have one route in global.asax registered like this: routes.Add(new LowercaseRoute("{action}/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller = "Home", action = "Index", id =…
pbz
  • 8,865
  • 14
  • 56
  • 70
10
votes
3 answers

Get current action and controller and use it as a variable in an Html.ActionLink?

I need to be able to dynamically retrieve the current action and controller name of whatever page you're on, and actually use them to create a new HTML.ActionLink that links to the same action and controller name, but in a different area. So I guess…
EPM
  • 171
  • 1
  • 5
  • 16
9
votes
2 answers

Providing or Filtering assemblies when registering areas for an ASP.NET MVC 2.0 application

I have a large application that currently exists as a hybrid of WebForms and MVC 2.0. Startup of my application is dreadful, and the culprit is primarily because of the AreaRegistration.RegisterAllAreas call. More specifically, that it is using the…
moribvndvs
  • 42,191
  • 11
  • 135
  • 149
9
votes
2 answers

Set default area - Avoiding `, new {area = ""}` on each link on the site

This code is inside the master page:
  • ">Main site link
  • ">Area link
  • All the links works good…
    Fitzchak Yitzchaki
    • 9,095
    • 12
    • 56
    • 96
    1 2
    3
    38 39