CodeBehind is a modern full-stack web framework under ASP.NET Core. CodeBehind was developed by Elanat in 2023 and competes with Microsoft's default web frameworks (ASP.NET Core MVC and Razor Pages and Blazor). CodeBehind is an engineering masterpiece that simultaneously provides the possibility of development based on MVC, Model-View, Controller-View, only View and Web-Forms. The type of structure and naming in CodeBehind is a nostalgia that reminds of former Microsoft Web-Forms. CodeBehind has nothing to do with the old web-form in .NET. In CodeBehind, you can use Razor syntax (@Razor) and standard syntax (<%=Standard%>). CodeBehind is .NET Diamond! In many scenarios, CodeBehind performs better than the default frameworks in ASP.NET Core.
$ dotnet add package CodeBehindCodeBehind library is a backend framework. This library is a programming model based on the MVC structure, which provides the possibility of creating dynamic aspx files (similar to .NET Standard) in .NET Core and has high serverside independence. CodeBehind framework supports standard syntax and Razor syntax. This framework guarantees the separation of server-side codes from the design part (html) and there is no need to write server-side codes in the view.
The CodeBehind framework is faster than the default structure of cshtml pages in ASP.NET Core.
CodeBehind is .NET Diamond!
In every scenario, CodeBehind performs better than the default structure in ASP.NET Core.
Programming in CodeBehind is simple. The simplicity of the CodeBehind project is the result of two years of study and research on back-end frameworks and how they support web parts.
First, CodeBehind was supposed to be a back-end framework for the C++ programming language; our project in C++ was going well, we built the listener structure and we were even able to implement fast-cgi in the coding phase for the Windows operating system. Windows operating system test with nginx web server was very stable and fast; but for some reason, we stopped working and implemented CodeBehind on .NET Core version 7.
View section: aspx page (razor syntax)
@page
@{
Random rand = new Random();
}
<div>
<h1>Random value: @rand.Next(1000000)</h1>
</div>
View section: aspx page (standard syntax)
<%@ Page %>
<%
Random rand = new Random();
%>
<div>
<h1>Random value: <%=rand.Next(1000000)%></h1>
</div>View File: Default.aspx (razor syntax)
@page
@controller YourProjectName.DefaultController
@model YourProjectName.DefaultModel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@model.PageTitle</title>
</head>
<body>
@model.BodyValue
</body>
</html>View File: Default.aspx (standard syntax)
<%@ Page Controller="YourProjectName.DefaultController" Model="YourProjectName.DefaultModel" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><%=model.PageTitle%></title>
</head>
<body>
<%=model.BodyValue%>
</body>
</html>Model File: Default.aspx.Model.cs
using CodeBehind;
namespace YourProjectName
{
public partial class DefaultModel : CodeBehindModel
{
public string PageTitle { get; set; }
public string BodyValue { get; set; }
}
}Controler File: Default.aspx.Controller.cs
using CodeBehind;
namespace YourProjectName
{
public partial class DefaultController : CodeBehindController
{
public DefaultModel model = new DefaultModel();
public void PageLoad(HttpContext context)
{
model.PageTitle = "My Title";
model.BodyValue = "HTML Body";
View(model);
}
}
}Program File: Program.cs
using CodeBehind;
using SetCodeBehind;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
+ CodeBehindCompiler.Initialization();
app.Run(async context =>
{
+ CodeBehindExecute execute = new CodeBehindExecute();
+ await context.Response.WriteAsync(execute.Run(context));
});
app.Run();We added CodeBehind in Nuget so that you can access it easily. You can use it in:
CodeBehind is a stable and reliable framework; Elanat is the most powerful .NET system implemented using the CodeBehind framework.