CodeBehind 1.9.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeBehind --version 1.9.0
NuGet\Install-Package CodeBehind -Version 1.9.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeBehind" Version="1.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CodeBehind --version 1.9.0
#r "nuget: CodeBehind, 1.9.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CodeBehind as a Cake Addin
#addin nuget:?package=CodeBehind&version=1.9.0

// Install CodeBehind as a Cake Tool
#tool nuget:?package=CodeBehind&version=1.9.0

alternate text is missing from this package README image

Code_behind

CodeBehind library is a modern backend framework. This library is a programming model based on the MVC structure, which provides the possibility of creating dynamic aspx files 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.

Why use CodeBehind?

  • Fast: The CodeBehind framework is faster than the default structure of cshtml pages in ASP.NET Core.
  • Simple: Developing with CodeBehind is very simple. You can use mvc pattern or model-view or controller-view or only view.
  • Modular: It is modular. Just copy the new project files, including dll and aspx, into the current active project.
  • Get output: You can call the output of the aspx page in another aspx page and modify its output.
  • Under .NET Core: Your project will still be under ASP.NET Core and you will benefit from all the benefits of .NET Core.
  • Code-Behind: Code-Behind pattern will be fully respected.
  • Modern: CodeBehind is a modern framework with revolutionary ideas.

CodeBehind is .NET Diamond!

In every scenario, CodeBehind performs better than the default structure in ASP.NET Core.

ASP.NET Core VS CodeBehind table

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.

CodeBehind story

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.

Only view example

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>

MVC example

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);
        }
    }
}

CodeBehind Configure in ASP.NET Core

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();

Documents

How to use CodeBehind?

Simple and structured MVC in CodeBehind

It is not necessary to follow the MVC pattern

Load aspx page finally result in another aspx page

Examples of development

Web part in CodeBehind

Razor syntax reference for CodeBehind framework

Constructor method

HtmlData classes

Template

Layout

Option

Namespace and dll for CodeBehind view class

Error detection

New features on new versions

How is the list of views finally made?

Performance test in only view section in version 1.5.2 (ASP.NET Core VS CodeBehind)

ASP.NET Core VS CodeBehind; why should we use CodeBehind?

CodeBehind framework vs Code-Behind pattern

CodeBehind training (On YouTube)

Video 1- Hello World!

Video 2- Set dynamic header

Video 3 - Page list in default page

Download CodeBehind

We added CodeBehind in Nuget so that you can access it easily. You can use it in:

https://www.nuget.org/packages/CodeBehind

Elanat was created using CodeBehind

CodeBehind is a stable and reliable framework; Elanat is the most powerful .NET system implemented using the CodeBehind framework.

https://github.com/elanatframework/Elanat

Elanat is based on CodeBehind

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.3 0 5/12/2024
2.4.2 105 3/31/2024
2.4.1 84 3/31/2024
2.4.0 108 3/5/2024
2.3.0 85 2/17/2024
2.2.0 112 1/26/2024
2.1.2 137 1/6/2024
2.1.1 94 1/5/2024
2.1.0 86 1/5/2024
2.0.0 147 12/23/2023
1.9.3 109 12/18/2023
1.9.2 125 12/9/2023
1.9.1 103 12/2/2023
1.9.0 116 11/30/2023
1.8.1 113 11/27/2023
1.8.0 106 11/26/2023
1.7.0 151 10/18/2023
1.6.1 108 10/18/2023
1.6.0 114 10/18/2023
1.5.2 126 9/28/2023
1.5.1 128 9/19/2023
1.5.0 110 9/13/2023
1.4.3 136 9/3/2023
1.4.2 139 8/30/2023
1.4.1 155 8/26/2023
1.4.0 117 8/23/2023
1.3.2 127 8/12/2023
1.3.1 123 8/12/2023
1.3.0 131 8/12/2023
1.2.0 144 7/24/2023
1.1.1 152 7/4/2023
1.1.0 142 7/3/2023
1.0.0 169 6/30/2023