Does ASP.NET Core and .NET Framework ASP.NET Web application such as MVC5 and Web Forms use the same HTML controls and Server-side code

Donald Symmons 3,066 Reputation points
2023-04-14T08:00:18.9433333+00:00

May I please ask if the ASP.NET Core and .NET Framework ASP.NET Web application such as MVC5 and Web Forms use the same server-side code and same client-side controls? If no please may I know in details what differs; if there is an article that best explains this in detail, please do care to share ? Thank you

Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Other
Developer technologies ASP.NET Other
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-04-14T16:27:27.54+00:00

    webforms is a control tree design. that is the server build a control tree in memory, then walks the tree and calls the render method on the tree control to produce the html. when the aspx file is parsed, a control tree is built using server controls. your code behind has the option to update the control tree before render. pseudo events are generated to mimic control events based on post back data.

    MVC 5 maps the post back data to a model, calls a control method to process the data and create the view model. the view model is then passed to the razor template engine to render the html. webform server control are not used, but technically they could be used by creating an instance of the control, and calling the render method go get the html it would produce.

    asp.net core was a rewrite of MVC 5 only. it does not have any webform support, so no server controls. also asp.net core and the razor engine only support C# (but can call libraries within in VB.net). razor tag helper support was added. these are something like the old server controls, but are just templates and have no post back event support.

    asp.net core then added razor page support, an alternative to MVC. the razor template engine and the postback data and controller method binding are supported by a single page. the folder structure can be used to define routing. this is the recommend for porting webform code, but is still requires a rewrite of all the aspx code.

    lastly asp.net core added blazor support. this is a component tree design. the components are built with razor component syntax (different from razor page tag helpers). these components can directly process browser client events.


1 additional answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
    2023-04-14T09:47:47.4766667+00:00

    Hi @Donald Symmons,

    First for ASP.NET Web Forms applications:

    ASP.NET Web Forms is only available in the .NET Framework. ASP.NET Core cannot be used with ASP.NET Web Forms.

    .NET(ASP.NET Core) vs. .NET Framework(ASP.NET) for server apps:Both share many of the same components, and you can share code across the two. However, there are fundamental differences between the two, and your choice depends on what you want to accomplish. You can view documentation for .NET Framework technologies that are not available on .NET.

    Best regards,

    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.