Transformations.Web 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Transformations.Web --version 3.0.0
                    
NuGet\Install-Package Transformations.Web -Version 3.0.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="Transformations.Web" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Transformations.Web" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Transformations.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 Transformations.Web --version 3.0.0
                    
#r "nuget: Transformations.Web, 3.0.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 Transformations.Web@3.0.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=Transformations.Web&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Transformations.Web&version=3.0.0
                    
Install as a Cake Tool

Transformations.Web

Typed ASP.NET Core helpers for IConfiguration, session, cookies, query strings, HTTP responses, and MVC dropdowns — eliminating repetitive untyped boilerplate in controllers and middleware.

NuGet .NET 8 | 9 | 10

📖 Overview

Transformations.Web provides typed, one-liner extensions for the ASP.NET Core surfaces you touch in every controller and middleware: IConfiguration, session, cookies, query strings, HTTP responses, and MVC dropdowns.

🚀 Why Transformations.Web?

ASP.NET Core's native APIs for configuration, session, and cookies all deal in untyped strings. Every controller ends up with the same parse-check-fallback boilerplate repeated across dozens of methods. These extensions collapse that pattern into a single typed call — GetValue<T>(key, fallback) — and bring the same discipline to query strings, cookie management, and SelectList construction.

📦 Install

<PackageReference Include="Transformations.Web" Version="3.0.0.0" />

💡 What's Included

Typed IConfiguration Access

// Read with explicit type and fallback
int limit = ConfigurationHelper.GetValue<int>(config, "Security:RateLimit", defaultValue: 100);

// Read as string with fallback
string dsn = ConfigurationHelper.GetSetting(config, "Sentry:Dsn", defaultValue: string.Empty);

// Connection string shortcut
string cs = ConfigurationHelper.GetConnectionString(config, "DefaultConnection");

// Existence check
bool hasKey = ConfigurationHelper.ContainsKey(config, "FeatureFlags:NewDashboard");

Session State (Typed)

Session values are serialized to JSON and deserialized on read, so any serializable type works:

// Store
SessionHelper.SetValue(httpContext, "cart", cartObject);

// Retrieve with fallback
var cart = SessionHelper.GetValue<ShoppingCart>(httpContext, "cart");

// Check existence
bool hasCart = SessionHelper.Exists(httpContext, "cart");

// Clear a single key or the whole session
SessionHelper.Remove(httpContext, "cart");
SessionHelper.Clear(httpContext);

Query String Parsing

// Typed read with fallback
int page = QueryStringHelper.TryGetQuery<int>(httpContext, "page", defaultValue: 1);

// Presence check
bool hasFilter = QueryStringHelper.HasValue(httpContext.Request.Query, "filter");

// Get all as dictionary
var all = QueryStringHelper.GetAllQueryStrings(httpContext);
// ICookieHelper is DI-registered; inject it into your controller
string? token = _cookies.Get("auth_token");
_cookies.Set("pref", value, daysToExpiration: 30);
_cookies.Delete("auth_token");

Set writes the cookie as HttpOnly (configurable with Cookie:IsHttp, default true) and with SameSite=Lax. Its lifetime defaults to 360 days, set with Cookie:Duration. Its Secure flag follows the request: a cookie set over HTTPS is Secure, and one set over plain HTTP is not. Browsers reject a Secure cookie set over plain HTTP, except on localhost, so the flag follows the scheme. To force the flag either way, set Cookie:Secure to true or false.

HTTP Response Shortcuts

WebHelper.Redirect(httpContext, "/dashboard");
WebHelper.SetFileNotFound(httpContext);
WebHelper.SetInternalServerError(httpContext);
WebHelper.SetStatus(httpContext, 429);

// Async redirect with optional window target
await ResponseHelper.RedirectAsync(httpContext, "/login", target: "_top");

MVC SelectList Helpers

Convert a DataTable directly to a List<SelectListItem> for MVC/Razor dropdowns:

// Basic — specify the text column and value column
var items = dataTable.ToSelectList(nameColumn: "RoleName", valueColumn: "RoleId");

// With pre-selected item (matches by value or by name, case-insensitive)
var items = dataTable.ToSelectList("RoleName", "RoleId",
    selectedValue: currentRoleId.ToString());

🛠 API Reference

Class Purpose Key Members
ConfigurationHelper IConfiguration access GetSetting, GetValue<T>, GetConnectionString, TryGetSetting, ContainsKey, GetManualSetting
QueryStringHelper Query string parsing TryGetQuery<T>, HasValue, GetAllQueryStrings, ParseQueryString
SessionHelper Typed session state GetValue<T>, SetValue<T>, Exists, GetAllStrings, Remove, Clear
CookieHelper Cookie management Get, Set, Delete via ICookieHelper interface
WebHelper HTTP response control Redirect, Reload, SetFileNotFound, SetInternalServerError, SetStatus
ResponseHelper Async response helpers RedirectAsync with optional window target
SelectListExtensions DataTable → dropdown ToSelectList(nameColumn, valueColumn, selectedValue?, selectedName?)

📦 Dependencies

  • Transformations.Core
  • Microsoft.AspNetCore.App (framework reference)
  • Microsoft.Extensions.Configuration
  • Microsoft.Extensions.Configuration.Binder

License

PolyForm Strict 1.0.0 — Copyright © 2026 opentail.net

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. 
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 Transformations.Web:

Package Downloads
Transformations

Modern .NET transformation helpers for conversion, strings, collections, data, web, diagnostics, batching, and resilience.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.0 96 10/27/2026
3.0.0 98 10/27/2026
2.0.5.1 98 10/23/2026
2.0.4.6 101 10/11/2026
2.0.4.5 95 10/10/2026
2.0.4.2 153 7/7/2026
2.0.4.1 134 7/7/2026
2.0.0 147 4/10/2026