asp.net-mvc-areas

Visual studio 2017 / 2019 add areas missing

佐手、 提交于 2021-02-18 05:01:05
问题 While creating a ASP.NET MVC Core Web app using VS2017 / 2019, came across that 'Add Areas' option is missing from Context menu. 回答1: Area is not removed from VS 2017/19 but it is moved in Scaffolding and you can access the area using below steps: 1) Right click on your project and click on Add>New Scaffolded Item 2) After click choose the MVC area from the Menu: 3) After choosing give it Name, and after this the Area will be added to your project: Hope it will helps. 回答2: I had a same

Visual studio 2017 / 2019 add areas missing

寵の児 提交于 2021-02-18 05:01:01
问题 While creating a ASP.NET MVC Core Web app using VS2017 / 2019, came across that 'Add Areas' option is missing from Context menu. 回答1: Area is not removed from VS 2017/19 but it is moved in Scaffolding and you can access the area using below steps: 1) Right click on your project and click on Add>New Scaffolded Item 2) After click choose the MVC area from the Menu: 3) After choosing give it Name, and after this the Area will be added to your project: Hope it will helps. 回答2: I had a same

ASP.NET MVC ActionLink vs RedirectToAction for images in areas

别来无恙 提交于 2020-01-16 01:19:08
问题 I have an issue with an image that is a little hard to explain so hopefully this will make sense. I am using ASP.NET MVC 4 Razor. I have one area setup and I am using a layout page that in the root. Everything is working fine except one small issue. When I use an ActionLink in an area, my page renders just fine including the layout page except for the image on the page. If I use RedirectToAction in my controller, everything renders fine including the image. I can see the location of the image

Rounting in asp mvc areas - issue with more areas

怎甘沉沦 提交于 2020-01-02 20:09:15
问题 Routing make me crazy thees days :( I have two areas: CityPage and Job On the city page I have a list of links that navigate to Job area. This is code for action and routing for CityPage: public ActionResult Index(string city, string countryCode) { return View(); } In CityPageAreaRegistration.cs class: context.MapRoute( null, "CityPage/{countryCode}/{city}", new { area = "CityPage", controller = "Home", action = "Index", city = "" } ); URL that I get here is fine http://localhost/CityPage/UK

Get Areas associated with an MVC project

99封情书 提交于 2019-12-30 09:24:12
问题 Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views folder under each of the sub-folders. This approach, as you can tell, sucks. b) From the binary, I could enumerate all namespaces that match the criteria

Get Areas associated with an MVC project

别等时光非礼了梦想. 提交于 2019-12-30 09:24:10
问题 Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views folder under each of the sub-folders. This approach, as you can tell, sucks. b) From the binary, I could enumerate all namespaces that match the criteria

MVC 2.0 - different view based on URL with shared controls

烂漫一生 提交于 2019-12-24 18:43:23
问题 I have 2 master pages. One is intended to be shown in a normal standalone website. The other is to be used in external sites as an Iframe. I want to be able to show the normal page at http://example.com/home/index and the iframed version at http://example.com/framed/home/index I want to have controls that will postback to one controller so I don't have to duplicate logic, so they must be available in both the normal and iframed versions. My problem is that when I try and use areas, I just can

MVC Ninject: How to add NinJect bindings from an MVC Area project

送分小仙女□ 提交于 2019-12-24 14:06:19
问题 I've been using this blog example: http://blog.longle.net/2012/03/29/building-a-composite-mvc3-application-with-pluggable-areas/ I have the concepts working in my solution. However, I'm trying to figure out a good way only add bindings to the kernel if a user has permissions to access a module/area. I've read up some on the ServiceLocator but I was trying to stay away from it. One thing I'm trying just to get things to work is user Contructor injection in the default constructor for a module.

Mapping Subdomains to Areas in ASP.Net Core 3

半城伤御伤魂 提交于 2019-12-24 10:55:51
问题 What I want to achieve Mapping my normal domain e.g. example.com to no area if possible. Mapping my subdomain e.g. blog.example.com to a area named blog . What I have found There are actually quite a lot of posts regarding to this topic, especially mapping subdomains to areas. From SO: area-and-subdomain-routing asp-net-core-mapping-subdomains-to-areas Others: danylkoweb.com benjii.me web.archive.org And there are probably even more. Problem But there is one big problem, in ASP.Net Core 3

Asp.Net Core Area routing to Api Controller not working

南楼画角 提交于 2019-12-23 04:58:22
问题 I have an API controller hosted in an area. However, the routing doesn't seem to be working as my ajax calls keep returning 404's when trying to hit the controller actions. Breakpoints in the controller constructor are never hit. [Area("WorldBuilder")] [Route("api/[controller]")] [ApiController] public class WorldApiController : ControllerBase { IWorldService _worldService; IUserRepository _userRepository; public WorldApiController(IWorldService worldService, IUserRepository userRepository) {