CommonNetFuncs.Web.Common 4.0.53

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

CommonNetFuncs.Web.Common

License NuGet Version nuget

This lightweight project contains helper methods for several common functions required by applications.

Contents


ContentTypes

A static class exposing MIME type constants for common file formats (JSON, images, Office documents, media, web types) and a GetContentType extension method that resolves the MIME type from a file name or extension.

ContentTypes Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

GetContentType / GetContentTypeByExtension
using CommonNetFuncs.Web.Common;

string mime = "report.xlsx".GetContentType(); // "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
string mime = ContentTypes.GetContentTypeByExtension(".mp4"); // "video/mp4"

// Use a constant directly
string jsonMime = ContentTypes.Json; // "application/json"

</details>


PascalCaseJsonNamingPolicy

A JsonNamingPolicy implementation that capitalizes the first letter of every property name. Use it when your JSON consumer expects PascalCase names but your C# models use camelCase conventions.

PascalCaseJsonNamingPolicy Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

using CommonNetFuncs.Web.Common;

JsonSerializerOptions options = new()
{
    PropertyNamingPolicy = new PascalCaseJsonNamingPolicy()
};

// { "Name": "Alice", "Age": 30 } instead of { "name": "Alice", "age": 30 }
string json = JsonSerializer.Serialize(new { name = "Alice", age = 30 }, options);

</details>


SecurityHeadersStore

Provides a frozen dictionary of recommended security response headers (X-Xss-Protection, X-Frame-Options, Referrer-Policy, X-Content-Type-Options, X-Permitted-Cross-Domain-Policies, Content-Security-Policy) and a list of server-identifying headers to remove (Server, X-Powered-By). Intended to be used with UseCustomHeadersMiddleware from CommonNetFuncs.Web.Middleware.

SecurityHeadersStore Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

using CommonNetFuncs.Web.Common;
using CommonNetFuncs.Web.Middleware;

WebApplication app = builder.Build();

app.UseCustomHeaders(
    addHeaders: SecurityHeadersStore.SecurityHeaders,
    removeHeaders: SecurityHeadersStore.HeadersToRemove
);

</details>


UriHelpers

Extension methods for building and parsing query strings and URIs, including converting lists and key-value pairs into well-formed query parameter strings.

UriHelpers Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

ListToQueryParameters
using CommonNetFuncs.Web.Common;

// From a list of values with a shared key
IEnumerable<int> ids = [1, 2, 3];
string qs = ids.ListToQueryParameters("id"); // "id=1&id=2&id=3"

// From a collection of key-value pairs
IEnumerable<KeyValuePair<string, string>> filters =
[
    new("status", "active"),
    new("role", "admin")
];
string qs = filters.ListToQueryParameters(); // "status=active&role=admin"

</details>

Installation

Install via NuGet:

dotnet add package CommonNetFuncs.Web.Common

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET 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 (3)

Showing the top 3 NuGet packages that depend on CommonNetFuncs.Web.Common:

Package Downloads
CommonNetFuncs.Web.Requests

Helper methods that deal with creating, sending, and handling the responses from REST API calls

CommonNetFuncs.Web.Middleware

Misc middleware for ASP.NET MVC applications

CommonNetFuncs.Web.Interface

Helper methods that deal with ASP.NET Core interfaces

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.53 132 5/28/2026
4.0.43 155 5/14/2026
4.0.40 191 5/10/2026
4.0.39 137 5/10/2026
4.0.37 129 5/9/2026
4.0.36 131 5/8/2026
4.0.31 154 4/21/2026
4.0.29 133 4/20/2026
4.0.28 123 4/19/2026
4.0.25 138 4/3/2026
4.0.17 158 2/23/2026
4.0.15 140 2/8/2026
4.0.14 141 2/7/2026
4.0.12 139 2/3/2026
4.0.10 611 1/24/2026
3.8.42 162 3/5/2026
3.8.38 148 2/24/2026
3.8.33 158 2/2/2026
3.8.32 159 2/2/2026
Loading failed