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
<%@ Page Language="C#" CodeBehind="Default.aspx.cs" Inherits="elanat.SiteEmail" %>
View in ASP.NET Core
<%@ Page Controller="Elanat.SiteEmailController" Model="Elanat.SiteEmailModel" %>
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
public class SiteEmailModel
Model in ASP.NET Core
public partial class SiteEmailModel : CodeBehindModel
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
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace elanat
{
public partial class SiteEmail : System.Web.UI.Page
{
public SiteEmailModel model = new SiteEmailModel();
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.Form["btn_SendEmail"]))
btn_SendEmail_Click(sender, e);
if (string.IsNullOrEmpty(Request.Form["hdn_ContentId"]))
{
if (string.IsNullOrEmpty(Request.QueryString["content_id"]))
return;
if (!Request.QueryString["content_id"].IsNumber())
return;
model.ContentIdValue = Request.QueryString["content_id"].ToString(); ;
}
model.SetValue();
// Set Required Field Validation
model.SetImportantField();
}
protected void btn_SendEmail_Click(object sender, EventArgs e)
{
model.ContentIdValue = Request.Form["hdn_ContentId"];
model.YourEmailValue = Request.Form["txt_YourEmail"];
model.RecipientsEmailValue = Request.Form["txt_RecipientsEmail"];
model.CaptchaTextValue = Request.Form["txt_Captcha"];
// Evaluate Field Check
model.EvaluateField(Request.Form);
if (model.FindEvaluateError)
{
ResponseForm rf = new ResponseForm(StaticObject.GetCurrentSiteGlobalLanguage());
foreach (string EvaluateError in model.EvaluateErrorList)
rf.AddLocalMessage(EvaluateError, "problem");
rf.RedirectToResponseFormPage();
}
if (!model.CaptchaTextValue.MatchByCaptcha())
{
model.CaptchaIncorrectErrorView();
return;
}
model.SendEmail();
model.SuccessView();
}
}
}
Controller in ASP.NET Core

Join the conversation! Your thoughts help the community grow.