locked
Integrating Non-MVC & MVC Projects RRS feed

  • Question

  • User-1580299748 posted

    Hello All,

    I am writing an <g class="gr_ gr_51 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="51" data-gr-id="51">ASP .</g>Net Core Razor (Version 2.2) web application that is non-MVC.

    I would like to integrate a CMS/Blog (using Markdown) into my application, but do not want to write one from scratch.

    I want the Blog to reside in a /blog folder in my project.

    My research shows me that there are several GitHub project available that I can integrate.

    However, quite a few of them are MVC based.

    My project is not MVC.

    I do not understand how to integrate an MVC application into my non-MVC project.

    Any guidance/resources appreciated.

    Thanks in advance for your time!

    Wednesday, January 30, 2019 5:10 PM

Answers

  • User753101303 posted

    Hi,

    Another option could be to create a child application inside a parent site so that you can move each part separately. For example you have https://marcstan.net/blog/2017/09/16/Asp.Net-core-sub-applications-in-IIS/ for how to fix problems it could cause.

    If you prefer to have them in a single VS project I expect this to just work and I doubt you'll find some guidance about that. If unfamiliar with MVC try perhaps tocreate a MVC project and add Razor Pages to see what happens. If you need further help please be more explicit about the first problem you have when trying.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 30, 2019 5:37 PM

All replies

  • User475983607 posted

    Add MVC and a route in Configure method.

    //app.UseMvc();
    
    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });

    If you are asking how to integrate ASP.NET MVC into ASP.NET Core then you need two different projects and perhaps share the auth cookie.

    https://docs.microsoft.com/en-us/aspnet/core/security/cookie-sharing?view=aspnetcore-2.2

    Wednesday, January 30, 2019 5:27 PM
  • User-1580299748 posted

    Yes, I'm asking now to integrate an <g class="gr_ gr_40 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="40" data-gr-id="40">ASP .</g>Net MVC project into my <g class="gr_ gr_62 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="62" data-gr-id="62">ASP .</g>Net Core Razor (non-MVC) project.

    Thanks for the reference.  I will take a look at it.

    Wednesday, January 30, 2019 5:29 PM
  • User753101303 posted

    Hi,

    Another option could be to create a child application inside a parent site so that you can move each part separately. For example you have https://marcstan.net/blog/2017/09/16/Asp.Net-core-sub-applications-in-IIS/ for how to fix problems it could cause.

    If you prefer to have them in a single VS project I expect this to just work and I doubt you'll find some guidance about that. If unfamiliar with MVC try perhaps tocreate a MVC project and add Razor Pages to see what happens. If you need further help please be more explicit about the first problem you have when trying.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 30, 2019 5:37 PM