asp.net-mvc-areas

ASP.NET MVC 4 Areas in separate projects not working (view not found)

自闭症网瘾萝莉.ら 提交于 2019-11-27 17:54:05
I have tried to create simple proof-of-concept ASP.NET MVC 4 web site using areas in separate projects. I tried to following tutorials: http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects (Application doesn't work in virtual directory... I use IIS). I hope there is better way than virtual directories. Then I tried this tutorial: http://forums.asp.net/t/1483660.aspx/1 But there is no "AreasManifestDir" element in *.csproj of area project (and got error "The view 'Index' or its master was not found or no view engine supports the searched locations") Is there still support in ASP

RedirectToAction between areas?

本秂侑毒 提交于 2019-11-27 17:16:09
Is there a way to redirect to a specific action/controller on a different Area? Did you try this?: return RedirectToAction("action", "controller", new { area = "area" }); 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 RedirectToAction("action", "controller", new { area = "" }); I would like to ask a follow-up here. Understanding

How to Configure Areas in ASP.NET MVC3

断了今生、忘了曾经 提交于 2019-11-27 10:16:50
问题 Is anyone knows how to Configure Areas in ASP.NET MVC3. I read an article about Areas in here. But that article is not based on MVC3. In MVC3 there is no function named MapRootArea in RouteCollection routes which is found in Global.asax routes.MapRootArea("{controller}/{action}/{id}", "AreasDemo", new { controller = "Home", action = "Index", id = "" }); When i create a New Area using MVC3, i got a class of that area which inherited from AreaRegistration and look like following: (here Blogs is

How to use an Area in ASP.NET Core

时光总嘲笑我的痴心妄想 提交于 2019-11-27 06:48:16
How do I use an Area in ASP.NET Core? I have an app that needs an Admin section. This section requires its Views to be placed in that area. All requests that start with Admin/ will need to be redirected to that area. Vahid Amiri In order to include an Area in an ASP.NET Core app, first we need to include a conventional route in the Startup.cs file (It's best to place it before any non-area route): In Startup.cs/Configure method: app.UseMvc(routes => { routes.MapRoute("areaRoute", "{area:exists}/{controller=Admin}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller

Having issue with multiple controllers of the same name in my project

孤街浪徒 提交于 2019-11-27 06:46:42
I am running into the following error with my ASP.NET MVC 3 project: Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('Home/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter. The request for 'Home' has found the following matching controllers: MyCompany.MyProject.WebMvc.Controllers.HomeController MyCompany.MyProject.WebMvc.Areas.Company.Controllers

The controller for path was not found or does not implement IController

限于喜欢 提交于 2019-11-27 06:35:21
I have an MVC4 project with language selection: en nl fr de 1 main part with: About Common (for the menu) Contact Faq Home And 3 areas: Admin Customers Shop In each area I have at least one controller, for example in Admin I have the controller overview with the corresponding view folder overview which contains an index.aspx page. The home page and all the main pages (about, faq, etc.) work and can be visited). However, when I follow the url: localhost:xxxx/en/admin/overview I get the error: The controller for path '/en/admin/overview' was not found or does not implement IController. Even

How to specify an area name in an action link?

一个人想着一个人 提交于 2019-11-27 06:14:42
I have a shared master page which I am using from 2 different areas in my mvc 2 app. The master page has an action link which currently specifies the controller and action, but of course the link doesn't work if I'm in the wrong area. I see no overload for actionlink that takes an area parameter, is it possible to do? Figured it out.. Html.ActionLink("Link Text", "ActionName", "ControllerName", new { Area = "AreaName" }, new{}) Something I ran into right after this, that I imagine others might run into: If you need to link from within an area to an action not in an area, you still need to

Relative Content Path in MVC3 Areas

只愿长相守 提交于 2019-11-27 01:37:46
问题 I found this question Can't use relative paths with areas in ASP.NET MVC 2 which is the same issue I am having. Is this still the case in MVC3? Is there a way to keep content files in an area relative to the area? So that a layout file in an area can have something like Without having to either make a fully qualified link, requiring the areas directory and the area name or the solution of the above question which requires a check for each area on each request. update/edit I've decided to use

How can we set authorization for a whole area in ASP.NET MVC?

≯℡__Kan透↙ 提交于 2019-11-27 00:40:48
问题 I've an Admin area and I want only Admins to enter the area. I considered adding the Authorized attribute to every controller in the Admin area. Isn't there an elegant solution or is this feature not there in the framework itself? EDIT: I'm sorry, I should to have mentioned this before. I'm using a custom AuthorizedAttribute derived from AuthorizeAttribute. 回答1: Web.config-based security should almost never be used in an MVC application. The reason for this is that multiple URLs can

ASP.NET MVC 4 Areas in separate projects not working (view not found)

谁说我不能喝 提交于 2019-11-26 19:16:06
问题 I have tried to create simple proof-of-concept ASP.NET MVC 4 web site using areas in separate projects. I tried to following tutorials: http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects (Application doesn't work in virtual directory... I use IIS). I hope there is better way than virtual directories. Then I tried this tutorial: http://forums.asp.net/t/1483660.aspx/1 But there is no "AreasManifestDir" element in *.csproj of area project (and got error "The view 'Index' or its