Why is app.UseMvc() added when creating a Razor Pages Project?VS2017: Why razor project still refers to MVC?How do I import a namespace in Razor View Page?How to declare a local variable in Razor?Why is Razor Pages the recommended approach to create a Web UI in Asp.net Core 2.0?VS2017: Why razor project still refers to MVC?Asp.net core razor pages load partial pageASP.NET Core 2.0 Razor pages vs Full MVC CoreMapRoute for Razor PagesSimple Injector Inject into PageModel ASP.NET Core Razor PagesHow do you add AWS ASP.NET Core Logging to an ASP.NET Core 2.0 Razor Pages app?Remote Validation in Asp.Net Core Razor Pages
Shouldn’t conservatives embrace universal basic income?
Why is the "ls" command showing permissions of files in a FAT32 partition?
Pre-mixing cryogenic fuels and using only one fuel tank
A Trivial Diagnosis
Showing a sum is positive
Why does this expression simplify as such?
Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?
Why do Radio Buttons not fill the entire outer circle?
Has any country ever had 2 former presidents in jail simultaneously?
How does electrical safety system work on ISS?
Is there a way to have vectors outlined in a Vector Plot?
What is Cash Advance APR?
Giving feedback to someone without sounding prejudiced
awk assign to multiple variables at once
What is the English pronunciation of "pain au chocolat"?
It grows, but water kills it
Change the color of a single dot in `ddot` symbol
Will number of steps recorded on FitBit/any fitness tracker add up distance in PokemonGo?
Short story about a deaf man, who cuts people tongues
Quoting Keynes in a lecture
Review your own paper in Mathematics
Mimic lecturing on blackboard, facing audience
Microchip documentation does not label CAN buss pins on micro controller pinout diagram
Were Persian-Median kings illiterate?
Why is app.UseMvc() added when creating a Razor Pages Project?
VS2017: Why razor project still refers to MVC?How do I import a namespace in Razor View Page?How to declare a local variable in Razor?Why is Razor Pages the recommended approach to create a Web UI in Asp.net Core 2.0?VS2017: Why razor project still refers to MVC?Asp.net core razor pages load partial pageASP.NET Core 2.0 Razor pages vs Full MVC CoreMapRoute for Razor PagesSimple Injector Inject into PageModel ASP.NET Core Razor PagesHow do you add AWS ASP.NET Core Logging to an ASP.NET Core 2.0 Razor Pages app?Remote Validation in Asp.Net Core Razor Pages
I'm new to ASP.NET Core
and Razor
and I apologize if this is insanely obvious somewhere.
After doing some research, I elected to use Razor Pages over MVC
as I thought there would be more benefits and liked the idea of the code behind page models etc.. I chose ASP.NET Core Web Application
-> Web Application
and create a new project targeting ASP.NET Core 2.2
.
The default template appears to create a "pure" RP project - eg. The Pages folder instead of MVC's Controller/Models/Views.
I'm getting really confused because there are still elements of MVC in the RP project - eg. app.useMvc()
in Startup.cs, the inclusion of _ViewStart.cshtml, the use of ViewData["x"].
Realistically this is fine and one can press on but then following RP guides and supposed conventions seems to go haywire - eg. _PageStart.cshtml doesn't actually work from my testing.
Where am I going wrong - am I reading into it or caring too much? Hopefully someone can enlighten me! Thanks in advance for trying :)
asp.net-core razor razor-pages
New contributor
add a comment |
I'm new to ASP.NET Core
and Razor
and I apologize if this is insanely obvious somewhere.
After doing some research, I elected to use Razor Pages over MVC
as I thought there would be more benefits and liked the idea of the code behind page models etc.. I chose ASP.NET Core Web Application
-> Web Application
and create a new project targeting ASP.NET Core 2.2
.
The default template appears to create a "pure" RP project - eg. The Pages folder instead of MVC's Controller/Models/Views.
I'm getting really confused because there are still elements of MVC in the RP project - eg. app.useMvc()
in Startup.cs, the inclusion of _ViewStart.cshtml, the use of ViewData["x"].
Realistically this is fine and one can press on but then following RP guides and supposed conventions seems to go haywire - eg. _PageStart.cshtml doesn't actually work from my testing.
Where am I going wrong - am I reading into it or caring too much? Hopefully someone can enlighten me! Thanks in advance for trying :)
asp.net-core razor razor-pages
New contributor
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
2
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago
add a comment |
I'm new to ASP.NET Core
and Razor
and I apologize if this is insanely obvious somewhere.
After doing some research, I elected to use Razor Pages over MVC
as I thought there would be more benefits and liked the idea of the code behind page models etc.. I chose ASP.NET Core Web Application
-> Web Application
and create a new project targeting ASP.NET Core 2.2
.
The default template appears to create a "pure" RP project - eg. The Pages folder instead of MVC's Controller/Models/Views.
I'm getting really confused because there are still elements of MVC in the RP project - eg. app.useMvc()
in Startup.cs, the inclusion of _ViewStart.cshtml, the use of ViewData["x"].
Realistically this is fine and one can press on but then following RP guides and supposed conventions seems to go haywire - eg. _PageStart.cshtml doesn't actually work from my testing.
Where am I going wrong - am I reading into it or caring too much? Hopefully someone can enlighten me! Thanks in advance for trying :)
asp.net-core razor razor-pages
New contributor
I'm new to ASP.NET Core
and Razor
and I apologize if this is insanely obvious somewhere.
After doing some research, I elected to use Razor Pages over MVC
as I thought there would be more benefits and liked the idea of the code behind page models etc.. I chose ASP.NET Core Web Application
-> Web Application
and create a new project targeting ASP.NET Core 2.2
.
The default template appears to create a "pure" RP project - eg. The Pages folder instead of MVC's Controller/Models/Views.
I'm getting really confused because there are still elements of MVC in the RP project - eg. app.useMvc()
in Startup.cs, the inclusion of _ViewStart.cshtml, the use of ViewData["x"].
Realistically this is fine and one can press on but then following RP guides and supposed conventions seems to go haywire - eg. _PageStart.cshtml doesn't actually work from my testing.
Where am I going wrong - am I reading into it or caring too much? Hopefully someone can enlighten me! Thanks in advance for trying :)
asp.net-core razor razor-pages
asp.net-core razor razor-pages
New contributor
New contributor
edited 18 hours ago
Andrei Fiordean
778
778
New contributor
asked 18 hours ago
jazz127jazz127
62
62
New contributor
New contributor
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
2
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago
add a comment |
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
2
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
2
2
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago
add a comment |
1 Answer
1
active
oldest
votes
razor pages, whilst they do not use controllers, are actually part of the mvc framework and require you to call app.UseMvc() in order to initilise everything it needs including routing etc.
You can also use UseMvc to do some configuration to your application:
app.AddMvc()
.AddRazorPagesOptions(options =>
options.Conventions.Add("options");
);
More information on this can be found at https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2
New contributor
add a comment |
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
);
);
jazz127 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55279532%2fwhy-is-app-usemvc-added-when-creating-a-razor-pages-project%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
razor pages, whilst they do not use controllers, are actually part of the mvc framework and require you to call app.UseMvc() in order to initilise everything it needs including routing etc.
You can also use UseMvc to do some configuration to your application:
app.AddMvc()
.AddRazorPagesOptions(options =>
options.Conventions.Add("options");
);
More information on this can be found at https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2
New contributor
add a comment |
razor pages, whilst they do not use controllers, are actually part of the mvc framework and require you to call app.UseMvc() in order to initilise everything it needs including routing etc.
You can also use UseMvc to do some configuration to your application:
app.AddMvc()
.AddRazorPagesOptions(options =>
options.Conventions.Add("options");
);
More information on this can be found at https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2
New contributor
add a comment |
razor pages, whilst they do not use controllers, are actually part of the mvc framework and require you to call app.UseMvc() in order to initilise everything it needs including routing etc.
You can also use UseMvc to do some configuration to your application:
app.AddMvc()
.AddRazorPagesOptions(options =>
options.Conventions.Add("options");
);
More information on this can be found at https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2
New contributor
razor pages, whilst they do not use controllers, are actually part of the mvc framework and require you to call app.UseMvc() in order to initilise everything it needs including routing etc.
You can also use UseMvc to do some configuration to your application:
app.AddMvc()
.AddRazorPagesOptions(options =>
options.Conventions.Add("options");
);
More information on this can be found at https://docs.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2
New contributor
New contributor
answered 17 hours ago
G-BG-B
5613
5613
New contributor
New contributor
add a comment |
add a comment |
jazz127 is a new contributor. Be nice, and check out our Code of Conduct.
jazz127 is a new contributor. Be nice, and check out our Code of Conduct.
jazz127 is a new contributor. Be nice, and check out our Code of Conduct.
jazz127 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55279532%2fwhy-is-app-usemvc-added-when-creating-a-razor-pages-project%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
Possible duplicate of VS2017: Why razor project still refers to MVC?
– Henk Holterman
16 hours ago
2
For what it's worth, you don't have to pick one or the other. The specific project templates are there just to give you a jumpstart, but you can use Razor Pages, MVC, and even Web Api all in the same project. There's some things Razor Pages are better for and there's some things that MVC works better for. You should mix and match as appropriate. Don't try to force your code into one particular convention or the other.
– Chris Pratt
15 hours ago