0

I worked on a project that until recently had no need for areas. Now that I've added an area (TemporaryUser) I'm having difficulty making use of a shared _Error view that is not within its own area.

I know I could just create another area, call it "master" or something, and access its views through typical routing, however it would mean reorganising quite a few files and changing paths.

Is there a way to return a view that is not in an area from within a controller action, that is?

return View("~/Views/Shared/_Error.cshtml", ResponseMessages.TEMP_USER_BATCH_NOT_EXIST);

Where this is in {area}/{controller}/{action} but as you can see the view I'd like to use is in the default shared folder given in MVC 4.

Lee
  • 3,869
  • 12
  • 45
  • 65
  • Same answer: [MVC redirect to a view without a controller](http://stackoverflow.com/questions/26237029/mvc-redirect-to-a-view-without-a-controller) – Balde Mar 14 '16 at 15:52
  • I use what you suggested my other projects but it doesn't help answer the more generic problem. Imagine I didn't ask the question with regard to the _Error view. – Lee Mar 14 '16 at 15:58
  • Then, you can use `RedirectToAction("MyAction", "MyController", new { area = "" })` that is an abstracion of `RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary(new { area = "", controller = "MyController", action = "MyAction" }))` [RedirectToAction outside of Areas](http://stackoverflow.com/questions/3203062/redirecttoaction-outside-of-areas) – Balde Mar 14 '16 at 16:08
  • So there is no simple way to do it via a path? Some views may not be associated with a controller action. However if this is the most simple method then so be it. – Lee Mar 15 '16 at 10:31

0 Answers0