locked
Invoking Asp.Net core web page from existing asp.net web application RRS feed

  • Question

  • User2100544042 posted

    Hi Team,

    I'm working on a project(Web application) which is on Asp.net and few pages are in asp.

    we are planning to move few pages to Asp.Net Core.

    Request you to guide us on how to navigate from Existing Web application to new Asp.Net core page and what are the configuration chnages required for the same.

    Thanks,

    Reshma V

    Tuesday, May 21, 2019 5:58 AM

All replies

  • User-2054057000 posted

    Hi Team,

    I'm working on a project(Web application) which is on Asp.net and few pages are in asp.

    we are planning to move few pages to Asp.Net Core.

    Request you to guide us on how to navigate from Existing Web application to new Asp.Net core page and what are the configuration chnages required for the same.

    Thanks,

    Reshma V

    If you are moving from ASP.NET Web Forms to ASP.NET Core MVC then you will have to start from the beginning as there isn't any similarity between the 2 frameworks. I suggest you to star understanding the ASP.NET Core framework from the very beginning. You can follow this Asp.Net Core tutorial.

    I suggest you to spend at least 1 week to understand the ASP.NET Core before proceeding.

    Tuesday, May 21, 2019 12:03 PM
  • User-474980206 posted

    as asp.net project can not host an asp.net core app, nor can they be be deployed to the same website in IIS. The asp.net core would be a new project and be deployed to its own website (must be root).  razor pages are the closest to asp, and webforms. there is no plan to move webforms to asp.net core.

    to convert asp page, learn the razor syntax, and convert the code.  there is very little migration from webforms to core, its mostly a rewrite. if you followed standard principles your BI and DAL projects should port to .net standard. This should be the first step. Upgrade to 4.8, and convert all libraries to .net standard.

    Tuesday, May 21, 2019 2:13 PM
  • User1520731567 posted

    Hi ReshmaV,

    It’s a bit difficult to migrate ordinary asp.net projects to MVC because they have different frameworks.

    Microsoft took a "convention over configuration" approach when building MVC web applications.

    And it does not use the concept of View State (which is present in ASP.NET). This helps in building applications, which are lightweight and gives full control to the developers.

    You first need to understand the MVC framework:

    Model

    The Model component corresponds to all the data-related logic that the user works with.

    This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data.

    View

    The View component is used for all the UI logic of the application.

    Controller:

    Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component

    and interact with the Views to render the final output. 

    You need to create at least a controller,a action and a view.

    If you need to display data from database on the page, you also need to have a model.

    You also need to pay attention to routing configuration:

    There will always be a Default route pointing to a main page when your web application starts.

    Add a minimal amount of routes and consider these like Regular Expressions.

    They will replace the controller/action/id with a default value. This file is located in the App_Start/RouteConfig.cs.

    Like:

     public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
                routes.MapRoute(
                    "Default",                                              // Route name
                    "{controller}/{action}/{id}",                           // URL with parameters
                    new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
                );
            }

    I suggest you could learn some mvc fundamentals from these links:

    https://www.danylkoweb.com/Blog/aspnet-mvc-convention-over-configuration-BU

    https://docs.microsoft.com/en-us/aspnet/mvc/mvc5

    Best Regards.

    Yuki Tao

    Wednesday, May 22, 2019 3:18 AM