asp.net-mvc-areas

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

假装没事ソ 提交于 2019-12-18 11:34:30
问题 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

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

隐身守侯 提交于 2019-12-18 10:56:06
问题 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 possible to get it to work, right? I've created a solution, added a MVC 3 project, added an area and some content. All is working well. Now I created a new class library project (in the same solution), added a reference to it from the MVC-project,

The view 'Index' or its master was not found.

跟風遠走 提交于 2019-12-18 03:00:45
问题 The view 'Index' or its master was not found. The following locations were searched: ~/Views/ControllerName/Index.aspx ~/Views/ControllerName/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx I got this error when using ASP.Net mvc area. The area controller action are invoked, but it seems to look for the view in the 'base' project views instead of in the area views folder. 回答1: What you need to do is set a token to your area name: for instance: context.MapRoute( "SomeArea

Controllers split by areas [duplicate]

雨燕双飞 提交于 2019-12-17 18:33:37
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I register a controller that has been created in an AREA I have the question - is it possible to do the next? I have three Areas: _Default SiteOne SiteTwo Inside each area i have a ApiController with the same name, but in different namespaces of course: MvcAppliaction.Areas._Default.Controllers.ValuesController MvcAppliaction.Areas.SiteOne.Controllers.ValuesController MvcAppliaction.Areas.SiteTwo

RedirectToAction between areas?

回眸只為那壹抹淺笑 提交于 2019-12-17 15:10:27
问题 Is there a way to redirect to a specific action/controller on a different Area? 回答1: Did you try this?: return RedirectToAction("action", "controller", new { area = "area" }); 回答2: Your answer was helpful to me. Just wanted to add below: If you want to redirect from one area to another area, above code works well. And, if you want to redirect from one area to a controller/view which is not there in the area folder (i.e. in most cases, your front end), you can specify area = "". i.e. return

MVC 4 Areas not working properly

亡梦爱人 提交于 2019-12-14 03:58:06
问题 I have created a sample VB project in VS2010 to add Areas to the web UI but when I run it gives the following error: The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. I also added AreaRegistration.RegisterAllAreas() to the global.asax file and also tried to manually register

Best practices for ASP.NET MVC areas

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 19:42:50
问题 I'm currently building a CMS system, and I need to have an easy way include or exclude components. My first think was to use asp.net mvc area feature, to identified each component on itself. But from what I see, the area feature has problems, so maybe it not that good idea. 回答1: After a few experience with area feature, I think that areas are best for something entirely different in your site, that not share the same master page with the root area. In my case, that components are an add-ons

MVC 2.0, StructureMap, Areas, and Duplicate Controller Names

江枫思渺然 提交于 2019-12-13 05:14:09
问题 I have a bit of a problem. I have an area called Framed. This area has a home controller. The default for the site also has a home controller. What I'm trying to do with this is have a version of each controller/action that is suitable for an IFrame, and a version that is the normal site. I do this through Master pages, and the site masterpage has many different content place holders than the framed version. For this reason I can't just swap the master page in and out. For example, http:/

Consuming Web Api's as HttpPost

╄→гoц情女王★ 提交于 2019-12-13 03:55:26
问题 Can somebody help me how to post an array of type long to a WebApi. I think I have to use PostAsync from HttpClient, but I am not sure how to put array to HttpContent. This is my controller. [HttpPost] [Authorize] public void UpdateBatchesToReadyToShip(long[] batchIds) { // process request } And this is how I am trying to consume API var buffer = Encoding.ASCII.GetBytes("username:password"); var authHeader = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(buffer)); client

MVC5 Area not behaving properly

巧了我就是萌 提交于 2019-12-13 02:36:22
问题 This post is directly related to: MVC5 Area not working That post fixed the index.cshtml issue, however it did not resolve each view for that controller. For example: http://localhost:45970/Setup/Start gives the error that the resource cannot be found (basically a 404). However http://localhost:45970/Setup/Setup/Start brings up the correct page. So what needs to be reconfigured so that ALL views for that controller in the Setup Area will open properly? Edit 1 Code from SetupAreaRegistration