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













1















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 :)










share|improve this question









New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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















1















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 :)










share|improve this question









New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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













1












1








1








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 :)










share|improve this question









New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question









New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 18 hours ago









Andrei Fiordean

778




778






New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 18 hours ago









jazz127jazz127

62




62




New contributor




jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






jazz127 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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






  • 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












1 Answer
1






active

oldest

votes


















1














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






share|improve this answer








New contributor




G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















    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.









    draft saved

    draft discarded


















    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









    1














    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






    share|improve this answer








    New contributor




    G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      1














      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






      share|improve this answer








      New contributor




      G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        1












        1








        1







        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






        share|improve this answer








        New contributor




        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        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







        share|improve this answer








        New contributor




        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 17 hours ago









        G-BG-B

        5613




        5613




        New contributor




        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        G-B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






















            jazz127 is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript