Introduction
CMS version 1 was created based on ASP.NET Standard; in a short time, CMS migrated to ASP.NET Core; therefore, CMS version 2 is based on ASP.NET Core. This CMS uses the CodeBehind framework; this framework is an infrastructure whose executable files are aspx that run on ASP.NET Core.
The migration of this CMS from .NET Standard version 4.5 to .NET Core version 7.0 took only two weeks.
Note. Web development in the CodeBehind framework is based on a modern MVC structure and has nothing to do with Microsoft's Web Form.
An example of .NET Standard code changes to .NET Core
View in ASP.NET Standard
View in ASP.NET Core
As you can see, only the first line of the aspx page information has changed, and the rest of the data has remained unchanged.
Model in ASP.NET Standard
Model in ASP.NET Core
CodeBehind namespace has been added in the model section class; also, the word partial has been added before the class name. The parent class name of CodeBehindModel is also added in front of the model class name.
Controller in ASP.NET Standard
Controller in ASP.NET Core
Controller section changes have also been done simply.
The following are the controller changes:
Added CodeBehind namespace.
System.Web.UI.Page has been removed, and CodeBehindController has been added instead.
The underline of the main method has been remove(Page_Load
to PageLoad
).
The main method has been changed from private to public.
The following input arguments were omitted.
The following new argument is added.
View(model)
method; Added before the end of the main method
To access the current HttpContext, the HttpContext context argument has been added inside the btn_SendEmail_Click method.
Added context prefix to Request
Please note that the capitalization of the first letter of the project name and the addition of Controller to the name of the MemberChangeEmail class is for arranging the naming and is not required!
We created some methods that were in standard .NET but not in .NET using Extension methods, and the codes remained intact.
Example of SaveAs method on IFormFile.
Fortunately, all the data remained unchanged, and the source code of the server side also had minor changes; For example, the App_Data directory remains as a relic of the ASP.NET standard.
The CMS repository based on ASP.NET Core can be seen in the link below
https://github.com/elanatframework/Elanat
CMS external add-on repository
https://github.com/elanatframework/Elanat_add-ons
Code-Behind library is a backend framework
https://github.com/elanatframework/Code_behind
CMS old
We created a new repository and copied all the information from the ASP.NET Standard-based CMS repository into the new repository. This repository's README.md file provides information on how to migrate CMS from ASP.NET Standard to ASP.NET Core.
You can see the CMS repository based on ASP.NET Standard in the link below.