AsNet.Shared.Http
1.2.0.3
dotnet add package AsNet.Shared.Http --version 1.2.0.3
NuGet\Install-Package AsNet.Shared.Http -Version 1.2.0.3
<PackageReference Include="AsNet.Shared.Http" Version="1.2.0.3" />
<PackageVersion Include="AsNet.Shared.Http" Version="1.2.0.3" />
<PackageReference Include="AsNet.Shared.Http" />
paket add AsNet.Shared.Http --version 1.2.0.3
#r "nuget: AsNet.Shared.Http, 1.2.0.3"
#:package AsNet.Shared.Http@1.2.0.3
#addin nuget:?package=AsNet.Shared.Http&version=1.2.0.3
#tool nuget:?package=AsNet.Shared.Http&version=1.2.0.3
AsNet.Shared.Http
A shared, enterprise‑grade HTTP infrastructure library for .NET that simplifies API consumption, supports high‑performance streaming, and provides built‑in OAuth2 / OpenID Connect integration (IdentityServer ready).
Features
- Generic, strongly‑typed HTTP API client abstraction.
- Full HTTP verb support: GET, POST, PUT, DELETE.
- Sync and async APIs.
- High‑performance streaming using
IAsyncEnumerable<T>. - Advanced error handling with rich metadata (
ApiEx). - Built‑in JSON serialization configuration with custom converters.
- Integration with HttpClientFactory.
- Centralized configuration via
appsettings.json. - OAuth2 / OpenID Connect token management (IdentityServer compatible).
- Pluggable token providers (Strategy pattern).
- Ready‑to‑use IPStack geolocation service.
- SQL Server Reporting Services (SSRS) helpers.
- Multi‑framework support.
Typical Use Cases
- Enterprise microservices communication
- High‑performance API consumption
- Streaming large datasets
- Accessing secured APIs with OAuth2 / OIDC
- IP geolocation services
- SSRS report execution and management
- Shared HTTP infrastructure libraries
Supported Frameworks
- .NET Standard 2.1
- .NET 6
- .NET 7
- .NET 8
- .NET 9 / .NET 10 (forward compatible)
The same API surface and development experience are preserved across all runtimes.
Core Components
HTTP API Services
IApiService<T>(for .NET 6+)IApiServiceNetStandard<T>(for .NET Standard 2.1)
Provides:
- Typed HTTP requests and responses
- Tuple‑based results
(Result, HttpResponseMessage, ApiEx) - Byte array downloads
- GET and DELETE with body support
- Configurable timeout and JSON serialization
Streaming APIs
Efficient processing of large responses using:
IAsyncEnumerable<T>- Incremental JSON deserialization
ResponseHeadersRead
Available methods:
GetAsyncEnumerablePostAsyncEnumerableGetFromJsonAsyncEnumerable(NET 8+)
JSON Serialization
- Based on
System.Text.Json - Extended with
Dahomey.Json - Includes custom converters:
TimeSpanJsonConverter
Default configuration supports:
- Case‑insensitive properties
- Trailing commas
- Comments
- Optimized buffers
Error Handling
HTTP errors are transformed into structured exceptions:
- HTTP status and response propagation
- Automatic parsing of validation errors (
ModelState) - Dynamic error payload extraction
- Rich diagnostic data via
Exception.Data
Security & Authentication
OAuth2 / OpenID Connect
Includes a token service designed for secured APIs and IdentityServer.
Supported Grant Types
- Client Credentials
- Authorization Code
- Password
- On‑Behalf‑Of (OBO)
- Token Exchange
Key Types
ITokenServiceITokenProviderTokenServiceTokenRequestContext
Built‑in providers:
ClientCredentialsTokenProviderAuthorizationCodeTokenProvider
Token acquisition is fully decoupled and provider‑driven.
IPStack Integration
Includes a ready‑to‑use IP geolocation service:
IPStackService(NET 6+)IPStackServiceNetStandard
Features:
- IP‑based geolocation lookup
- Standardized result wrapping
- Integrated error handling
- Configuration via
HttpSettings
SQL Server Reporting Services (SSRS)
Helpers for SSRS integration:
- Report execution and export
- Report catalog navigation
- Parameter discovery
- Support for SSRS 2005 and 2010+
Supported export formats:
- PDF, Excel, Word, XML, CSV, HTML, MHTML, Image
Required Configuration
HTTP Settings
"AsNet": {
"Http": {
"HttpSettings": {
"HandlerLifetime": "00:05:00",
"Timeout": "00:02:00",
"DefaultClientName": "AsNetSharedHttp",
"IPStackURL": "http://api.ipstack.com",
"IPStackAccessKey": "<your-api-key>"
}
}
}
### IdentityServer Settings
(Required only when accessing secured APIs)
```json
"AsNet": {
"Security": {
"IdentityServerSettings": {
"Address": "https://your-identityserver",
"ClientId": "<client-id>",
"ClientSecret": "<client-secret>",
"Scope": "<scope>"
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- AsNet.Shared (>= 3.2.0.3)
- Dahomey.Cbor (>= 1.26.2)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- System.Formats.Asn1 (>= 10.0.5)
- System.Security.Cryptography.Pkcs (>= 10.0.5)
- System.ServiceModel.Http (>= 8.1.2)
-
net10.0
- AsNet.Shared (>= 3.2.0.3)
- Dahomey.Cbor (>= 1.26.2)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- System.Security.Cryptography.Pkcs (>= 10.0.5)
- System.ServiceModel.Http (>= 10.0.652802)
-
net8.0
- AsNet.Shared (>= 3.2.0.3)
- Dahomey.Cbor (>= 1.26.2)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- System.Formats.Asn1 (>= 10.0.5)
- System.Security.Cryptography.Pkcs (>= 10.0.5)
- System.ServiceModel.Http (>= 8.1.2)
-
net9.0
- AsNet.Shared (>= 3.2.0.3)
- Dahomey.Cbor (>= 1.26.2)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 9.0.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- System.Formats.Asn1 (>= 10.0.5)
- System.Security.Cryptography.Pkcs (>= 10.0.5)
- System.ServiceModel.Http (>= 8.1.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AsNet.Shared.Http:
| Package | Downloads |
|---|---|
|
AsNet.Shared.Data
Enterprise‑grade multi‑tenant data infrastructure library for .NET that provides secure integration with AsNetSecurity, dynamic connection string resolution per tenant, and generic data access components built on Entity Framework Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.2.0.3 | 82 | 4/7/2026 | |
| 1.2.0.2 | 106 | 4/6/2026 | |
| 1.2.0.1 | 138 | 2/8/2026 | |
| 1.2.0 | 170 | 1/13/2026 | |
| 1.1.2 | 285 | 6/30/2025 | |
| 1.1.1 | 310 | 1/6/2025 | |
| 1.1.0.5 | 268 | 12/9/2024 | |
| 1.1.0.4 | 269 | 12/9/2024 | |
| 1.1.0.3 | 280 | 11/11/2024 | |
| 1.1.0.2 | 313 | 9/6/2024 | |
| 1.1.0.1 | 271 | 6/20/2024 | |
| 1.1.0 | 277 | 6/9/2024 | |
| 1.0.7.1 | 412 | 9/29/2023 | |
| 1.0.7 | 252 | 9/28/2023 | |
| 1.0.6.10 | 261 | 9/23/2023 | |
| 1.0.6.8 | 256 | 9/23/2023 | |
| 1.0.6.7 | 225 | 9/23/2023 | |
| 1.0.6.6 | 270 | 9/2/2023 | |
| 1.0.6.5 | 335 | 6/15/2023 | |
| 1.0.6.4 | 360 | 6/12/2023 |
• Optimized and customized JSON serialization using System.Text.Json and Dahomey.Json.
• Improved overall HTTP client performance.
• Added Dependency Injection (DI) ready services for Web API consumption.
• Introduced TimeSpanJsonConverter to properly support TimeSpan properties with System.Text.Json.
• Multi‑framework support: .NET Standard 2.1, .NET 8.0, .NET 9.0, and .NET 10.0.
• Enhanced async methods to return a Tuple (T, HttpResponseMessage, ApiException) for improved diagnostics.
• Added GET and DELETE methods with BodyRequest support.
• Added GetByteArray and GetByteArrayAsync methods for binary content retrieval.
• Added streaming methods: GetAsyncEnumerable, PostAsyncEnumerable, and GetFromJsonAsyncEnumerable.
• Streaming APIs return IAsyncEnumerable<T>, enabling higher performance and memory‑efficient data processing.