asp.net-mvc-areas

How is other content besides views handled with PortableAreas from the MVCContrib library?

I have seen blog entries like ASP.Net MVC Portable Areas - Part 2 that indicate that the build action for views must be set to Embedded Resource. What about other content such as images and CSS? Should they be set to Embedded Resource as well? Will the PortableArea ViewEngine pull that content out as well? ...

Castle Windsor with ASP.NET MVC 2 Areas

Been lurking for a few months and decided to jump in with a question. I am very new to Windsor and IoC in general. I can get Windsor to work with my MVC2 project with no problem. The project I am working on is a "portal" of multiple applications under one MVC2 project using the new Areas concept. In this scenario, each Area will actu...

Limit controllers to specific area only

I have one Area and in AreaRegistration I defined namespace all controllers in area belongs to. context.MapRoute( "Admin_default", "Admin/{controller}/{action}/{id}", new { controller="Home", action = "Index", id = UrlParameter.Optional }, new[] { "MySite.Admin.Controllers"...

MVC Areas - View not found

Hi, I have a project that is using MVC areas. The area has the entire project in it while the main "Views/Controllers/Models" folders outside the Areas are empty barring a dispatch controller I have setup that routes default incoming requests to the Home Controller in my area. This controller has one method as follows:- public ActionR...

How to use an Areas mechanism with asp.net MVC 1

To use separation of concern and to optimize the clearness of the controllers we decided to split each action of a controller into different controllers (FunctionalLocationEditController, FunctionalLocationCreateController and such). Problem now is the Global.asax is currently a bit big for just a few pages registered in routes. We wo...

Default Controller for an Area?

This is sort of a duplicate of http://stackoverflow.com/questions/2045761/trouble-setting-a-default-controller-in-mvc-2-rc-area But his answer doesn't satisfy me, because it doesn't work. I have the following /Areas/TestArea/Controllers/HelloController /Areas/TestArea/Views/Hello/Index /Controllers/HomeController /Views/Home/Index ...

Are MVC2 areas with multiple projects supported in the final release?

I had been following this guide to get areas with multiple projects setup: http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx I was stumbling on the step where you modify the .csproj files to enable the AfterBuild configuration. My googling led me to this post from Steve Mosely: http://avingtonsolutions.com/blog/post/2010/04...

Asp.Net MVC - Area Route - UrlHelperExtensions

I still Create Extension methods of UrlHelper to generate your url from Route as per the Best Practices post by Kazi Manhur. I'm curious to know if a better way emerged with MVC 2 and Areas (which I now use)? So basically in your Html call a url helper extension which return a string anyhow that match an existing route. Something does...

ASP.NET MVC Areas: How to hide "Area" name in URL?

When running the MVC 2 Areas example that has a Blog Area and Blog Controller the URL looks like this: http://localhost:50526/Blog/Blog/ShowRecent in the format: RootUrl / AreaName / ControllerName / ActionName Having just discovered MVC Areas, it seem like a great way to organise code, ie create an Area for each section, which in m...

MVC2 Areas and unit testing for routes

Hello, I want to test my routes in unit tests. But Areas is not working in my unit tests. Is it possible to test ASP.NET MVC 2 routes for Areas? I am using this code [SetUp] public void SetUp() { this.routes = new RouteCollection(); MvcApplication.RegisterRoutes(this.routes); } #endregion private ...

Different controllers with the same name in two different areas results in a routing conflict

I have two areas: ControlPanel and Patients. Both have a controller called ProblemsController that are similar in name only. The desired results would be routes that yield /controlpanel/problems => MyApp.Areas.ControlPanel.Controllers.ProblemsController and /patients/problems => MyApp.Areas.Patients.Controllers.ProblemsController. Ea...

What Patterns Should I Apply to ASP.NET MVC Areas?

What is the best way to model MVC Areas for my Application? Can I manage these Areas dynamically? What is the best usage of them? Thanks ...

ASP.Net MVC per area membership

I am building an ASP.Net MVC app that will run on a shared hosting account to host multiple domains. I started with the default template that includes membership and created an mvc area for each domain. Routing is set up to point to the correct area depending on the domain the request is for. Now I would like to set up membership speci...

Reuse an MVC area in multiple MVC applications?

I have some common web pages that will be in multiple MVC applications. For those pages I'd like to reuse the same source code (controllers + views) between the different MVC web sites. What is the best way to go about doing this? ASP.NET MVC areas seem like one possibility but they just a sub directory of the website project. Is it pos...

CompliationLock throws HttpException when registering areas for ASP.NET MVC unit tests

The moment I added a unit test to my ASP.NET MVC application to test some of the area routing, I got an HttpException coming out of the System.Web.Complication.CompilationLock type initializer with the following stack trace. System.Web.HttpException : The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception. ...

how big should your controllers be in asp.net-mvc

i see the new feature of areas in asp.net-mvc 2. it got me thinking. why would i need this? i did some reading on the use cases and it came down to a specific point to me around how big and how broad scope should my controllers should be? should i try to have many little controllers? one big controller? how do people determine the ...

how to have minimum AreaRegistrations with putting duplicated elements in single place

hi all, i have several AreaRegistration classes which one each registers own routes and each one have some duplicated elements such as bolded text in below: context.MapRoute("Search", "**{culture}/{style}**/search", new { **culture = cultureValue, ...

How to reference other Areas?

Hi, I have a controller called "Account" in my main site and I would like to reference a method on it from with in an Asp.net MVC 2 Area. It seems by default that Areas only have access to the controllers within that Area which makes sense, but there doesn't seem to be an option to reference controllers from another area. Thanks! ...

MVC2 Areas and Controller 404

My project namespace is MyProject.MVC So my controllers, which are segregated into Areas, are in this namespace: MyProject.MVC.Areas.AreaName But when I try to access a controller action in this namespace, I get a 404 error: http://MySite/AreaName/Action/View If I "remove" the MVC portion from the namespace on my controllers, ev...

Forms Authentication (restrict an area)

Hi all... I'm developing an website using asp.net mvc with MySQL and I need to make a simple restrict area for the user update some informations in website. So, I had created an area in mvc application called "Admin", and I know how to protect it using Forms authentication and Autorize attribute! It works fine, but in each controller of ...