Sphere10.Framework.Web 3.2.0

dotnet add package Sphere10.Framework.Web --version 3.2.0
                    
NuGet\Install-Package Sphere10.Framework.Web -Version 3.2.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="Sphere10.Framework.Web" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sphere10.Framework.Web" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Sphere10.Framework.Web" />
                    
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 Sphere10.Framework.Web --version 3.2.0
                    
#r "nuget: Sphere10.Framework.Web, 3.2.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.
#:package Sphere10.Framework.Web@3.2.0
                    
#: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=Sphere10.Framework.Web&version=3.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Sphere10.Framework.Web&version=3.2.0
                    
Install as a Cake Tool

Sphere10.Framework.Web

This library provides web models and formatting helpers that need no ASP.NET Core host. Use it for sitemaps, navigation trees, user messages and display formatting in any .NET application. It is the lowest of the Framework's web layers and references only Sphere10.Framework. Hosting, HTTP and session integration live in Sphere10.Framework.Web.AspNetCore.

Features

API Purpose
SitemapXml XML sitemap model whose entries carry an optional modification date, change frequency and priority.
Menu Navigation tree of text, URLs, icons, glyphs and child menus.
UserMessage, UserMessageType Information, warning or error message that any renderer can display.
Tools.Web.Html Display formatting and Animate.css class strings.
ParameterAttribute Request parameter name for an enum member, read by the ASP.NET Core query parameter helpers.
JDataTable, JDataTableParameters Obsolete jQuery DataTables transport models, kept for existing integrations.

Installation

Reference the package from a project that targets .NET 8 or later:

dotnet add package Sphere10.Framework.Web

Pass --version to match the other Sphere10.Framework packages in the application, and --source to restore from a local folder feed. The root README explains how to build and publish the packages, including to a private folder feed.

To build against the source instead, reference the project. From the repository root, these commands create a console project beside the repository for the examples below:

dotnet new console --name WebModelsDemo --output ../WebModelsDemo --framework net10.0
dotnet add ../WebModelsDemo/WebModelsDemo.csproj reference src/Sphere10.Framework.Web/Sphere10.Framework.Web.csproj

Quick start: generate a sitemap

Replace the console project's Program.cs with:

using System;
using System.IO;
using System.Xml.Serialization;
using Sphere10.Framework.Web;

var sitemap = new SitemapXml();
sitemap.Add("https://example.com/", frequency: SitemapXml.Frequency.Weekly, priority: 1.0);
sitemap.Add("https://example.com/help", new DateTime(2026, 10, 1), SitemapXml.Frequency.Monthly, 0.5);

// Declare the sitemap namespace as the default namespace, without the xsi and xsd prefixes.
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, "http://www.sitemaps.org/schemas/sitemap/0.9");

var path = Path.Combine(AppContext.BaseDirectory, "sitemap.xml");
using (var file = File.Create(path))
	new XmlSerializer(typeof(SitemapXml)).Serialize(file, sitemap, namespaces);
Console.WriteLine(File.ReadAllText(path));

Run it from the repository root:

dotnet run --project ../WebModelsDemo -p:BuildRevision=0

The program writes sitemap.xml beside its binaries and prints it. SitemapXml serializes as the standard urlset of url entries with loc, lastmod, changefreq and priority elements. It omits the optional elements that were not set and writes lastmod as a date without a time.

Each URL is a dictionary key, so Add throws ArgumentException for a URL that is already present. Call HasNode(url) first when URLs can repeat. The model does not crawl a site or serve an endpoint. The MVC XmlResult example serves it from a controller, and XmlResult serializes it with Tools.Xml from Sphere10.Framework.Data.

Domains

Every folder of Sphere10.Framework.Web is a domain with its own README, which lists all of its public types.

Domain What it provides Source
ExternalLibs Typed models for two client-side libraries, the Animate.css class names and the obsolete jQuery DataTables server-side protocol. source
Presentation Host-independent web models for navigation menus and messages shown to a user. source
Processing An attribute that names the request parameter an enum member stands for. source
Sitemap An XML sitemap model that serializes to the standard sitemaps.org urlset document. source

Project root

Types declared in the project folder itself:

Type Kind Purpose
Tools.Web.Html tools Display formatting through Percent and Beautify, and Animate.css class strings through AnimationClass, RandomEntryAnimationClass and RandomExitAnimationClass.

Menu and UserMessage are data models, and your application renders them:

using Sphere10.Framework.Web;

var navigation = new Menu("Documentation", "/docs") {
	SubMenus = new[] {
		new Menu("Getting started", "/docs/start"),
		new Menu("API reference", "/docs/api")
	}
};
var message = new UserMessage("Your preferences were saved.", UserMessageType.Information);

The parameterless constructor gives a Menu the URL # and an empty SubMenus array. The optional third argument of the other constructor sets Glyph, and Icon is a separate property. The class serializes to XML as nested <Menu text="..." url="..." icon="..." glyph="..."> elements, so a navigation tree can be stored in an XML file. The ASP.NET Core layer adds HttpContext.GetUserMessages() for messages that belong to the current request.

Menu is only a lightweight web navigation model. Application menus, blocks and screens belong to the shared UI framework, which the WinForms and Blazor libraries implement.

Formatting and animation classes

using Sphere10.Framework.Web.AnimateCss;

var percentage = Tools.Web.Html.Percent(0.25m);
var displayValue = Tools.Web.Html.Beautify(123.4500m); // "123.45" in an English culture
var animation = Tools.Web.Html.AnimationClass(Animation.fadeIn, AnimationDelay.Seconds_0_0);
// animation: "animated fadeIn "

Percent and Beautify follow the current culture. Beautify returns an empty string for null, formats dates as yyyy-MM-dd HH:mm:ss, writes byte arrays as upper-case hexadecimal and drops trailing zeros from numbers. It does not HTML-encode its result, so let Razor or your renderer encode the text.

AnimationClass returns the unprefixed Animate.css classes animated <animation>, followed by an animation-delay-<n> class in which n counts tenths of a second. Seconds_0_0 adds no delay class, and the delay parameter defaults to Seconds_1_0. RandomEntryAnimationClass and RandomExitAnimationClass pick an animation from the EntryAnimationClasses and ExitAnimationClasses arrays. The library ships no CSS or JavaScript, so the application supplies compatible Animate.css styles and defines the delay classes.

Request parameter names

ParameterAttribute names the request parameter that an enum member stands for. PageParameterProcessor and HttpRequest.GetParameter<T>(Enum) in the ASP.NET Core layer read it, and a member without the attribute uses its own name:

using Sphere10.Framework.Web.Processing;

public enum SearchParameter {
	[Parameter(Name = "page")]
	Page
}

The attribute lives in Sphere10.Framework.Web.Processing rather than Sphere10.Framework.Web, so that a Blazor component which imports Sphere10.Framework.Web still resolves [Parameter] to the component parameter attribute.

Structure and dependencies

Folder or file Contents
Sitemap/ SitemapXml.
Presentation/ Menu, UserMessage and UserMessageType.
Processing/ ParameterAttribute.
ExternalLibs/AnimateCss/ Animation and AnimationDelay.
ExternalLibs/JQuery/ The obsolete DataTables models.
HtmlTool.cs Tools.Web.Html.

The project targets net8.0, net9.0 and net10.0, and also net11.0 when a .NET 11 SDK builds it. Its only project reference is Sphere10.Framework, and it has no ASP.NET Core framework reference. The MVC and Blazor libraries build on the shared ASP.NET Core layer above it.

Upgrading from the combined library

Releases up to 3.1.2 shipped these types inside Sphere10.Framework.Web.AspNetCore, under its namespaces. They now come from this package, which Sphere10.Framework.Web.AspNetCore references, so only the imports change:

Types Namespace
SitemapXml, Menu, UserMessage, UserMessageType, JDataTable, JDataTableParameters Sphere10.Framework.Web
Animation, AnimationDelay Sphere10.Framework.Web.AnimateCss
ParameterAttribute Sphere10.Framework.Web.Processing
Tools.Web.Html Tools.Web, unchanged

JDataTable and JDataTableParameters are marked [Obsolete] and remain only for existing jQuery DataTables integrations. New Blazor applications can use the typed CRUD grid instead.

Build and verification

From the repository root:

dotnet build src/Sphere10.Framework.Web/Sphere10.Framework.Web.csproj -p:BuildRevision=0
dotnet test tests/Sphere10.Framework.Web.AspNetCore.Tests -p:BuildRevision=0

This library has no test project of its own. The shared web tests serialize a SitemapXml through the MVC XmlResult. The Core consumer in package validation builds against the packed library and fails when ASP.NET Core or desktop UI packages appear in its restore graph. -p:BuildRevision=0 stops a local build from allocating the next build number.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sphere10.Framework.Web:

Package Downloads
Sphere10.Framework.Web.AspNetCore

Shared ASP.NET Core integration for Sphere10 Framework: hosting, dependency injection, logging, HTTP and session extensions, and middleware.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.0 0 11/24/2026
3.2.0-ci.173.45375449609.1 0 11/24/2026
3.2.0-ci.171.45374063975.1 0 11/24/2026
3.2.0-ci.169.45350717665.1 0 11/24/2026
3.2.0-ci.168.45166918016.1 44 11/23/2026
3.2.0-ci.163.43664782937.1 78 11/15/2026
3.2.0-ci.160.43660265392.1 78 11/15/2026
3.2.0-ci.159.43537748063.1 78 11/14/2026
3.2.0-ci.158.43536665157.1 75 11/14/2026
3.2.0-ci.157.43350632870.1 81 11/13/2026
3.2.0-ci.156.43233095581.1 79 11/12/2026