asp.net-mvc-areas

MVC Areas for enterprise - good or bad? [closed]

雨燕双飞 提交于 2019-12-04 08:25:31
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . Within a single project solution introducing Areas when you have a lot of controllers does improve separation and allows modules to easily be copied in or out of the solution. However in a large enterprise solution I would favour splitting the logic into separate projects

Can Areas in an ASP.NET MVC 2 application map to a subdomain?

烂漫一生 提交于 2019-12-04 08:20:46
问题 Is there a way to map the Areas within an ASP.NET MVC 2 application to subdomains such as movies.example.com/Theater/View/2 instead of example.com/Movies/Theater/View/2 where { area = "Movies", controller = "Theater", action = "View", id = 2 }. 回答1: Areas are not directly related to routing, so your question becomes "does routing support subdomains?" The answer to that is unfortunately that there is no built-in support for this. However, the good news is that many people have tried and found

Asp.net Mvc areas routing issue

倾然丶 夕夏残阳落幕 提交于 2019-12-04 03:51:20
问题 I want default page of the site to be Login.cshtml. I get the Exception: Error: The view 'LogIn' or its master was not found or no view engine supports the searched locations. The following locations were searched: I have 2 areas. Structure is shown below. My routeconfig is shown below. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Portal.Web { public class RouteConfig { public static void

ASP.NET Core RC2 Area not published

删除回忆录丶 提交于 2019-12-03 23:24:17
So I just updated my app to use ASP.NET Core RC2. I published it using Visual Studio and noticed that my Area is not published: This snapshot is from src\MyProject\bin\Release\PublishOutput : And here is my Area, named Admin in Visual Studio: Am I missing an step or what? You need to configure your publishOptions section of project.json to include the Areas folder which is not included in the default template: ex: "publishOptions": { "include": [ "wwwroot", "Views", "appsettings.json", "web.config", "Areas" ], "exclude": [ "bin" ] } Update If you want to ensure that your controllers and other

Reuse an MVC area in multiple MVC applications?

眉间皱痕 提交于 2019-12-03 16:09:54
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 possible to reuse an MVC area in multiple MVC applications? You could embed views into assemblies and implement a custom VirtualPathProvider . Look at "portable areas." http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib

How to set Area view as home page in ASP.NET MVC?

南笙酒味 提交于 2019-12-03 16:08:30
How to setup route for a view to be as home page of a domain in ASP.NET MVC application which contains Areas. I need a view of a particular area to be home page. How could this be done? I tried using the following code without any success. public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( name: "Home", url: "", defaults: new { controller = "Home", action = "Index" }, namespaces: new string[] { "WebApp.Areas.UI.Controllers" } ); } Brij In the Area folder there is a file by name AreaName AreaRegistration deriving from AreaRegistration, it has a function RegisterArea

Custom errors override in ASP.NET MVC area

大兔子大兔子 提交于 2019-12-03 15:47:53
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 there with the new customErrors element. Is there some better way to do this so that I don't have to create a root folder for any overrides? I've been looking for exactly the same thing. One slight change that I do is to use a location element within the main web

Durandal and MVC4 Areas for multiple SPAs

喜你入骨 提交于 2019-12-03 13:34:18
问题 I have a internet application mvc4 with areas, for my organization each area represent a SPA and through "Manage NuGet Package" I installed "Durandal 1.2.0", "Durandal Transitions 1.2.0" and "Durandal Router 1.2.0". I organized the folders and quit the "views" and "viewmodels" from folder "App" of Durandal and put the new views in folder "VIews" of mvc4 area for example: Areas-->NewArea-->Views-->ControllerFolder-->views-->shell.html Then I put the '"viewmodels" in "Script" folder for example

How to specify default Area without adding area = “” to every ActionLink

为君一笑 提交于 2019-12-03 10:38:58
I have a large existing application built on ASP.NET MVC2 RC2. All of my links look like this: htp//site/controller/action/id I just added an Area called: BigBird . Now when I'm in the BigBird area, all of my links look like this: htp://site/ BigBird /controller/action/id Problem is that none of those controllers/actions exist in my new Area. So I have to go through all of my actionlinks all over my application and put this routevalue: area = string.empty Is there any way around this? I don't know of away around it if you are using the standard MVC methods (other than maybe overriding them to

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

偶尔善良 提交于 2019-12-03 06:39:55
This code is inside the master page: <li><a href="<%=Url.Action("Action", "Controller") %>">Main site link</a></li> <li><a href="<%=Url.Action("AreaAction", "AreaController", new {area = "Area"}) %>">Area link</a></li> All the links works good till I'm going to the Area Link . When I go there all the routes of the main area don't work. To fix that I can use this: <li><a href="<%=Url.Action("Action", "Controller", new {area = ""}) %>">Main site link</a></li> My question is, is there a way to avoid , new {area = ""} on every link in the to the main site? Its very annoying to have this on every