asp.net-mvc-areas

Binding ListBox with a model in MVC3

最后都变了- 提交于 2019-11-30 18:10:21
问题 My model is public class SiteConfig { public SiteConfig() { } public int IdSiteConfig { get; set; } public string Name { get; set; } public byte[] SiteLogo { get; set; } public string Brands { get; set; } public string LinkColour { get; set; } public IEnumerable<SiteBrand> SiteBrands { get; set; } } and public class SiteBrand { public int Id { get; set; } public int SiteId { get; set; } public int BrandId { get; set; } public Brand Brand { get; set; } public SiteConfig SiteConfig { get; set;

Why are my Area specific Web API’s accessible from all other Areas?

房东的猫 提交于 2019-11-30 13:29:41
问题 I am currently working on a ASP.NET MVC 4 Web Application project that must adhere to the following design decisions: The main MVC application resides in the root of the solution. All administrator functionality resides in a separate area. Each external party (e.g. suppliers) has its own area. Each area, including the root, constitutes a well separated functional block. Functionality from one area may not be exposed to another area. This is to prevent unauthorized access of data. Each area,

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

家住魔仙堡 提交于 2019-11-30 12:44:28
问题 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 my case each section has its own controller. This means that each AreaName = ControllerName. The effect of this is the double AreaName/ControllerName path in the

ASP.NET Help Pages default home page?

假装没事ソ 提交于 2019-11-30 10:59:24
问题 I want to go to http://myserver and be able to get Help Pages as the default home page, so the first thing a guest to http://myserver should see is the Help Page. I have a default route set up like this: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } Then I have my Help Page

ASP.NET MVC ActionLink outside area

為{幸葍}努か 提交于 2019-11-30 08:08:28
A simple task in MVC, sometimes becomes a hard challenge. Well,i have an Area called Admin. I've a page named "Forbidden" inside the Shared's directory in this area. The goal is simple: I need to create an Html.ActionLink that generates a link to return to Home page which is OUTSIDE the Admin area. So i try, <%= Html.ActionLink("Back","Index",new {controller="Home"})%> ,and its generate : http://localhost/Admin/Home/Index Its wrong!I want: http://localhost/Home/Index How can i create a link from an area to the default controllers structure? Try this : <%= Html.ActionLink("Back", "Index", "Home

Why are my Area specific Web API’s accessible from all other Areas?

陌路散爱 提交于 2019-11-30 07:08:09
I am currently working on a ASP.NET MVC 4 Web Application project that must adhere to the following design decisions: The main MVC application resides in the root of the solution. All administrator functionality resides in a separate area. Each external party (e.g. suppliers) has its own area. Each area, including the root, constitutes a well separated functional block. Functionality from one area may not be exposed to another area. This is to prevent unauthorized access of data. Each area, including the root, has its own RESTfull API (Web API). All normal controllers in all areas, including

MVC Areas - View not found

 ̄綄美尐妖づ 提交于 2019-11-30 06:55:15
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 ActionResult Index(string id) { return RedirectToAction("Index", "Home", new {area = "xyz"}); } I also have a default route setup to use this controller as follows:- routes.MapRoute( "Default", // Default route "{controller}/{action}/{id}", new { controller = "Dispatch",

ASP.NET MVC routing and areas

前提是你 提交于 2019-11-30 06:49:39
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 this: (root)/admin/apples/search (root)/admin/apples/edit/3 (root)/admin/apples/add (root)/admin/oranges/search (root)/admin/oranges/edit/5 (root)/admin/oranges/add (root)/admin I have the area created. I have the controllers created with their respective views, but it is the routing that I can't seem to get. Any advice as to how I would achieve such routing? I am

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

房东的猫 提交于 2019-11-30 04:14:23
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 System.Web. Compilation.BuildManager.GetReferencedAssemblies to enumerate all types in assemblies directly referenced by the application and test them to see if they derive from AreaRegistration . Unfortunately, I have a number of third-party assemblies that happen to be quite extensive, so this initial load can be pretty bad. I'd have much better

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

我的未来我决定 提交于 2019-11-30 03:30:46
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 my case each section has its own controller. This means that each AreaName = ControllerName. The effect of this is the double AreaName/ControllerName path in the Url eg /Blog/Blog/ above Not having a complete clear understanding of routing, how could I setup routing