asp.net-mvc-areas

How will you register a custom view engine where in the Areas will not be affected?

I made a custom view engine for my application. ~/Themes/Default/Views.. And I have an Area called Admin. Area/Admin/Views.. I register my custom view engine in Global.asax : RegisterViewEngines(ViewEngines.Engines); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); When I browsed my admin site, it cant fin...

MVC area and virtual folders

I'd like the ability to add a sub "folder" to an MVC area. For instance, I have an area ~/areas/Support And, in some classic ASP code, I need to refer to an include file <!-- #include virtual="/Support/_inc/myinclude.asp"--> Just for grins I tried including a virtual folder /support that points to this virtual folder, but that, of...

ASP.NET MVC: possible to move "Home" to area?

Anyone know if it's possible to move the HomeController and Home related views into the Areas directory? I'm trying to keep my root directory nice and clean and avoid having the ~/Views and ~/Controllers directories if I can. Furthermore, I can see it causing some confusion by having to explain that those root folders are for homepage s...

RedirectToAction outside of Areas

Hey everyone, 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 do I do a RedirectToAction from inside an Area to a controller outside o...

How should I design a shared Module that is needed in 2 different ASP.NET MVC Applications?

I'm designing a Module that is to be consumed by two distinct WebSites. Everything will be written in MVC (the module and both web applications). I would like to design my module so that the code can be included from a shared location. I only want to maintain a single version. My first thought was the Area feature of MVC 2. But from...

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 http://webSiteName/Admin I am getting the error The resource cannot be found I tried it...

Custom errors override in ASP.NET MVC area

I would like to have custom error pages unique to an MVC area. Unfortunately, it appears that the Web.config override system doesn't take the MVC folder structure into account. If I want to override an area called "mobile", I have to create a root project folder (in with Views and Controllers) named "mobile" and put the Web.config in the...

Autofac 2.2 and ASP.NET MVC 2.0 Areas support

Hi there! In his blog Nicholas announced support for ASP.NET MVC 2.0 Areas. However, I couldn't get it working and from what I see in Autofac sourcecode, areas support is nowhere to be seen. More specifically, RegisterControllers return builder.RegisterAssemblyTypes(controllerAssemblies) .Where(t => typeof(IController).IsAssignable...

About organisation of an asp mvc application

I'm starting a new web application that will be made of multiple parts or modules. My client want to be able to redistribute the application with a subset of modules to some other clients. I read about Areas in mvc2 which seems to be what i'm looking at. I would also like to develop those modules in side projects and have the right one b...

How do I use EditorTemplates from an AREA outside the current in ASP.NET MVC

Consider a project with 2 Areas. /Areas/Blog /Areas/Dashboard Now say that my Blog area has an editor for the type SpecialBlog. /Areas/Blog/Views/Blog/EditorTemplates/SpecialBlog.ascx What if a view that is part of my Dashboard Area would like to display a special blog? The following code works from Views inside the "Blog" Area but n...

MVC areas and url rewriting

I have an Area called PlanningBoard which has a controller called PlanningBoardController and a view in \areas\PlanningBoard\Views\PlanningBoard\Index.aspx. However my url says; http://localhost:55736/PlanningBoard/PlanningBoard but I'd like it to say http://localhost:55736/PlanningBoard. I know I must be missing some rather large poin...

Why do ASP.NET MVC3 Areas and Razor Views produce this error?

The view at '~/Areas/SomeArea/Views/List/Index.cshtml' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl. The project structure is pretty much default. There is one area called SomeArea. It has a single controller called List. It does nothing except: public ActionResult Index() { return View("~/Areas/SomeArea/...

Possible to [Authorize] at the Area level in ASP.NET MVC 2?

Slapping on [Authorize] attributes on Controllers and Actions to restrict access is awesome. Is it possible to do the equivalent for an entire Area in MVC 2? Where I can restrict Area-wide access dependent on Roles/Users/whatever in a central place instead of littering them throughout all the Controllers? ...

Add slashes in Area name on an ASP.NET MVC 2 route

Currently I have an Area in my ASP.NET MVC 2 project call 'API', which is self explanatory. As the API of my web application matures, I will soon need to add version numbers to my address. ie/ Instead of : http://site/API/ I will need http://site/API/1.0/ http://site/API/1.1/ ... What's the best practise to achieve this in ASP.NE...

Get Areas associated with an MVC project

Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views...

Change default Visual Studio behavior for MVC 2 project

I've created an MVC 2 project with nested areas, such as: Areas -->A -->C --> Controllers --> Models --> Views -->D --> Controllers --> Models --> Views -->Controllers -->Models -->Views -->B -->E --> Controllers --> Models --> Views -->F --> Controllers ...

Are nested Areas possible in ASP.NET MVC 2?

I would like to create a project structure with nested areas. For instance I have a "Home" area and underneath this I would like the "News" area that handles it's own route registration and will properly find views when a route points to a controller in the "News" area. By changing the "News" area name to be "Home/News" instead of simp...

Custom routing within an area

Hi, i have an Area called Members and the following registered routes in the MembersAreaRegistration file: context.MapRoute( "Members_Profile", "Members/Profile/{id}", new { controller = "Profile", action = "Index", id = UrlParameter.Optional }, new string[] { "MyProject.Web.Mvc.Areas.Members.Controllers" } );...

existing web app, want to add 'Areas', what are the ramifications of this?

I have an exising asp.net MVC app, and I want to add 'Areas' now. What are the ramifications of this? Any gotchas? ...

ASP.Net MVC 2 Areas: The partial view '...' was not found

We recently upgraded a project to MVC 2 and we'd like to use Areas but there is an issue. We have created a new area, setup a controller, configured a route, and created a view in the correct location. When we run the code it successfully finds the route and hits the controller but when it goes to render the view there is an exception....