3

DXA can use a couple of views to render error messages: ServerError.cshtml, SectionError.cshtml and EntityError.cshtml.

Out of the box, the EntityError.cshtml comes from the Core area, the other modules are in the Views\Shared of the web application. You can also put all those views in Views\Shared.

However, when I moved those views in my custom module's area the webapp could not find the views. It would only search for views in the the Areas/Core/Views and Views/Shared. Can I tell DXA or .NET MVC to search in my area as well?

1 Answer 1

1

The fact that EntityError.cshtml is not in Views\Shared OOTB can be considered a defect (quirk at least). Can you create an issue (and possibly also a Pull Request) on GitHub for that?

Regarding putting those Views in your own Module/Area: what would be the reason to do that? What if you use multiple Modules which have those Views defined?

Note that DXA 1.7 allows you to configure a "Default Module" which makes it possible to pick up Views from another Module than Core by default. However, I don't think this covers those error Views.

2
  • In the mean time I created an issue for the EntityError.github.com/sdl/dxa-web-application-dotnet/issues/39 :)
    – Jan H
    Commented Dec 23, 2016 at 12:42
  • So the short answer is, it is not possible :) Since the EntityError is in the core module I tried to bring it into my own module so I can remove the core module area). I think it is fine putting it in the Views/Shared since it is not using the area registration anyway. A good reason to keep it in the module would be so that all views are nicely in one place.
    – Jan H
    Commented Dec 23, 2016 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.