CodeBehind 1.9.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeBehind --version 1.9.2
                    
NuGet\Install-Package CodeBehind -Version 1.9.2
                    
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.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBehind" Version="1.9.2" />
                    
Directory.Packages.props
<PackageReference Include="CodeBehind" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeBehind --version 1.9.2
                    
#r "nuget: CodeBehind, 1.9.2"
                    
#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.
#:package CodeBehind@1.9.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeBehind&version=1.9.2
                    
Install as a Cake Addin
#tool nuget:?package=CodeBehind&version=1.9.2
                    
Install as a Cake Tool

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

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

Programming
Creating high-level systems
CodeBehind training video (On YouTube)

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
4.6.0 97 2/6/2026
4.5.0 102 2/3/2026
4.4.1 103 1/2/2026
4.4.0 170 12/21/2025
4.3.3 263 10/9/2025
4.3.2 199 10/4/2025
4.3.1 132 10/4/2025
4.3.0 206 10/1/2025
4.2.0 290 6/25/2025
4.1.1 280 5/1/2025
4.1.0 284 3/22/2025
4.0.0 444 1/29/2025
3.9.2 449 12/8/2024
3.9.1 266 12/3/2024
3.9.0 270 11/29/2024
3.8.0 389 11/10/2024
3.7.2 343 10/22/2024
3.7.1 241 10/19/2024
3.7.0 611 10/14/2024
1.9.2 265 12/9/2023
Loading failed