asp.net-mvc-areas

RedirectToAction outside of Areas

隐身守侯 提交于 2019-12-08 16:39:13
问题 I've recently updated our MVC 2 project at work to use Areas however I'm having a little problem with the RedirectToAction method. We still have some of our controllers etc outside of our Areas. These controllers include the Home controller etc. How do I do a RedirectToAction from inside an Area to a controller outside of Areas. I thought something like the following might work but doesn't: return RedirectToAction("Index", "Home", new { area = "" }); or return RedirectToAction("Index", "Home"

Fallback route for MVC Areas

假如想象 提交于 2019-12-07 21:47:07
问题 Using asp.net core MVC application here. I have my areas defined and routing works as expected. One thing i would like to do, is have a fallback route in case the area does not exist. I have the following structure: APP -- Areas -- SharedArea -- Controllers -- LoginController -- UserController -- AnotherController -- AndSoOnController -- SomeArea1 -- Controllers -- HomeController -- SomeArea2 -- Controllers -- HomeController -- LoginController My ultimate goal, is to have shared controllers

Autofac Dependencies Per Area

江枫思渺然 提交于 2019-12-07 20:16:28
I'm creating a new MVC4 site using Autoface that has a public consumer site as well as an admin area for managing the consumer facing site. The admin site will be located in a different area be using the same services as the consumer facing site, but will not having some of the custom branding features. I've followed the advice given elsewhere of having a ViewDataFactory which provides a set of shared data for the view to use. My goal is to provide a different ViewDataFactory depending on what Area you are in. So for example, here is the Service that implements IViewDataFactory builder

Asp.Net MVC Areas, how can I use them?

三世轮回 提交于 2019-12-07 10:19:00
问题 I've got two questions about Asp.Net MVC areas. I have only a shallow understanding of areas from what I've heard about them in various podcasts but I think I understand fairly well what they're supposed to be used for. Now my question is if I could also use them to enable me to gradually switch from development in Asp.Net webforms with VB to Asp.Net MVC with C#. Can I mix areas of different languages in one application, for example one area is a C# project and another is a VB.Net project.

MVC Areas - Non Area Route Resolves To Area

眉间皱痕 提交于 2019-12-07 00:52:02
问题 I have added an area to my MVC 3 project. I cannot seem to get routing working with a very simple scenario. It seems to always want to resolve to the area. Here is my configuration. At startup: AreaRegistration.RegisterAllAreas(); IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Browse", action = "Index", id = UrlParameter.Optional } And public class AdminAreaRegistration : AreaRegistration { public override string

Does ASP.NET MVC create default routes for areas

牧云@^-^@ 提交于 2019-12-06 04:10:26
问题 I have a couple of areas in my MVC 3 application Auth and Users. I am using Phil Haacks Route Debugging tool to view a list of my routes and see which one gets selected based on my url. However there are a couple of routes present that I have not created in either my AreaRegistration file or Globalasax and I don’t know where they have come from or how to get rid of them. The routes are highlighted in yellow below. You can also see that I have created a default route in my Auth area

Asp.Net MVC Areas, how can I use them?

妖精的绣舞 提交于 2019-12-05 14:38:01
I've got two questions about Asp.Net MVC areas. I have only a shallow understanding of areas from what I've heard about them in various podcasts but I think I understand fairly well what they're supposed to be used for. Now my question is if I could also use them to enable me to gradually switch from development in Asp.Net webforms with VB to Asp.Net MVC with C#. Can I mix areas of different languages in one application, for example one area is a C# project and another is a VB.Net project. Could I use the areas feature to incorporate MVC into an existing webforms application? Lets say I have a

ASP.NET Core RC2 Area not published

老子叫甜甜 提交于 2019-12-05 11:13:19
问题 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? 回答1: 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",

Get current action and controller and use it as a variable in an Html.ActionLink?

ぃ、小莉子 提交于 2019-12-05 01:27:59
I need to be able to dynamically retrieve the current action and controller name of whatever page you're on, and actually use them to create a new HTML.ActionLink that links to the same action and controller name, but in a different area. So I guess I need to retrieve the current action and controller name as variables to use in building a new HTML.ActionLink. So, if I'm on the www.site.com/about page, I need to have a link dynamically generated to the www.site.com/es/about page. I've basically built a spanish translated version of my site in a separate area folder (with the same named

Is it possible to use different layouts in MVC4 based off of routes?

佐手、 提交于 2019-12-04 08:57:29
问题 I have a separate section (route) of my website that I would like to use a different layout/css etc. So when users at the main section of my website they get the default layout. But when they log in and go to the store, the store section (route) uses a different layout/css. So... www.blahblahblah.com/ www.blahblahblah.com/admin/ www.blahblahblah.com/home/contactus/ ...all use the default _Layout BUT... www.blahblahblah.com/store/ www.blahblahblah.com/store/admin/ ...use _LayoutStore I've seen