Multiple web MVC projects in one SLN and routing to the correct view folder
up vote
1
down vote
favorite
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 |
up vote
1
down vote
favorite
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 |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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 at 15:17
JDillon522
6,521103064
6,521103064
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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