Samhammer.Web.Common 6.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Samhammer.Web.Common --version 6.0.0                
NuGet\Install-Package Samhammer.Web.Common -Version 6.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="Samhammer.Web.Common" Version="6.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Samhammer.Web.Common --version 6.0.0                
#r "nuget: Samhammer.Web.Common, 6.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.
// Install Samhammer.Web.Common as a Cake Addin
#addin nuget:?package=Samhammer.Web.Common&version=6.0.0

// Install Samhammer.Web.Common as a Cake Tool
#tool nuget:?package=Samhammer.Web.Common&version=6.0.0                

Samhammer.Web.Common

This is a collection of tools to make creation of web projects simpler. It provides functionality that can be used in every web API project that is built with ASP.NET Core.

How to add this to your project:

Available Features

Version endpoint

If it is enabled you get an endpoint "/version" and "/api/version" that returns a json with the version number of the entry assembly and the hosting environment.

Add the following to the method Configure of your Startup.cs to enable it:

app.UseVersion();
Ping endpoint

If it is enabled you get an endpoint "/ping" that just returns "OK".

Add the following to the method Configure of your Startup.cs to enable it:

app.UsePing();
HttpClient with self signed certificates

If it is enabled you get an http client that also accepts untrusted certificates.

Add the following extension to your IWebHostBuilder in Program.cs:

.AddUnsignedHttpClient()

Afterwards you can create a specific http client by using the following code:

var client = HttpClientFactory.CreateClient(HttpClientNames.UnsignedHttpClient);

Furthermore you can allow self signed certs for an existing http client with the following block added to your IHttpClientBuilder:

.AddAllowUnsignedPrimaryHandler()
Exception handling

If you don't want to get error messages in your json api you can enable a default exception handler.

Add the following to the method Configure of your Startup.cs to enable it:

app.UseDefaultExceptionHandler();

Contribute

How to publish package
  • Create a tag and let the github action do the publishing for you
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.
  • net6.0

    • No dependencies.

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
8.0.0 2,053 3/8/2024
6.0.0 8,901 1/20/2022
3.2.0 462 10/22/2021
3.1.0 7,848 3/19/2020
1.3.0 497 3/16/2020
1.2.0 539 1/27/2020
1.1.0 472 1/22/2020
1.0.0 1,018 1/22/2020