Multiple web MVC projects in one SLN and routing to the correct view folder
Background: I'm working on a project to compare the different ways of building an api alongside the different ways to present views to the client. Namely, comparing a level 2 REST API, a level 3 REST API (with HATEOS), and a GraphQL api.On the client I want to compare a standard MVC web application, a Razor one, and an Angular one. You can see the current state of my project here. I used a couple of Pluralsight courses to configure identity server. Its nothing special and its mostly a bunch of random features for the sake of learning.
I dont want to duplicate a ton of logic and I enjoy the challenge. So I want to find a way to serve the different projects in the same sln. So far I've configured the authentication, data layer, and server projects.
The server is where the main and startup classes live.
Question: How can I serve views from controllers in different projects. In API. Authentication I want the Login views kept in that project.
I used this SO question to get me pointed in a direction:
How to specify the view location in asp.net core mvc when using custom locations?
In my Startup class I have this:
services.Configure<RazorViewEngineOptions>(options => {
options.ViewLocationFormats.Clear();
options.ViewLocationFormats.Add("/API.Authentication/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
});
When I go to localhost:8000/login
it errors but it says that its looking in the correct location.
How can I configure to point to multiple folders outside of the Startup Classe's directory?
asp.net-core
add a comment |
Background: I'm working on a project to compare the different ways of building an api alongside the different ways to present views to the client. Namely, comparing a level 2 REST API, a level 3 REST API (with HATEOS), and a GraphQL api.On the client I want to compare a standard MVC web application, a Razor one, and an Angular one. You can see the current state of my project here. I used a couple of Pluralsight courses to configure identity server. Its nothing special and its mostly a bunch of random features for the sake of learning.
I dont want to duplicate a ton of logic and I enjoy the challenge. So I want to find a way to serve the different projects in the same sln. So far I've configured the authentication, data layer, and server projects.
The server is where the main and startup classes live.
Question: How can I serve views from controllers in different projects. In API. Authentication I want the Login views kept in that project.
I used this SO question to get me pointed in a direction:
How to specify the view location in asp.net core mvc when using custom locations?
In my Startup class I have this:
services.Configure<RazorViewEngineOptions>(options => {
options.ViewLocationFormats.Clear();
options.ViewLocationFormats.Add("/API.Authentication/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
});
When I go to localhost:8000/login
it errors but it says that its looking in the correct location.
How can I configure to point to multiple folders outside of the Startup Classe's directory?
asp.net-core
add a comment |
Background: I'm working on a project to compare the different ways of building an api alongside the different ways to present views to the client. Namely, comparing a level 2 REST API, a level 3 REST API (with HATEOS), and a GraphQL api.On the client I want to compare a standard MVC web application, a Razor one, and an Angular one. You can see the current state of my project here. I used a couple of Pluralsight courses to configure identity server. Its nothing special and its mostly a bunch of random features for the sake of learning.
I dont want to duplicate a ton of logic and I enjoy the challenge. So I want to find a way to serve the different projects in the same sln. So far I've configured the authentication, data layer, and server projects.
The server is where the main and startup classes live.
Question: How can I serve views from controllers in different projects. In API. Authentication I want the Login views kept in that project.
I used this SO question to get me pointed in a direction:
How to specify the view location in asp.net core mvc when using custom locations?
In my Startup class I have this:
services.Configure<RazorViewEngineOptions>(options => {
options.ViewLocationFormats.Clear();
options.ViewLocationFormats.Add("/API.Authentication/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
});
When I go to localhost:8000/login
it errors but it says that its looking in the correct location.
How can I configure to point to multiple folders outside of the Startup Classe's directory?
asp.net-core
Background: I'm working on a project to compare the different ways of building an api alongside the different ways to present views to the client. Namely, comparing a level 2 REST API, a level 3 REST API (with HATEOS), and a GraphQL api.On the client I want to compare a standard MVC web application, a Razor one, and an Angular one. You can see the current state of my project here. I used a couple of Pluralsight courses to configure identity server. Its nothing special and its mostly a bunch of random features for the sake of learning.
I dont want to duplicate a ton of logic and I enjoy the challenge. So I want to find a way to serve the different projects in the same sln. So far I've configured the authentication, data layer, and server projects.
The server is where the main and startup classes live.
Question: How can I serve views from controllers in different projects. In API. Authentication I want the Login views kept in that project.
I used this SO question to get me pointed in a direction:
How to specify the view location in asp.net core mvc when using custom locations?
In my Startup class I have this:
services.Configure<RazorViewEngineOptions>(options => {
options.ViewLocationFormats.Clear();
options.ViewLocationFormats.Add("/API.Authentication/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
});
When I go to localhost:8000/login
it errors but it says that its looking in the correct location.
How can I configure to point to multiple folders outside of the Startup Classe's directory?
asp.net-core
asp.net-core
asked Nov 22 '18 at 15:17
JDillon522JDillon522
6,656103165
6,656103165
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433944%2fmultiple-web-mvc-projects-in-one-sln-and-routing-to-the-correct-view-folder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433944%2fmultiple-web-mvc-projects-in-one-sln-and-routing-to-the-correct-view-folder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown