AsNet.Shared.Http
1.2.1
See the version list below for details.
dotnet add package AsNet.Shared.Http --version 1.2.1
NuGet\Install-Package AsNet.Shared.Http -Version 1.2.1
<PackageReference Include="AsNet.Shared.Http" Version="1.2.1" />
<PackageVersion Include="AsNet.Shared.Http" Version="1.2.1" />
<PackageReference Include="AsNet.Shared.Http" />
paket add AsNet.Shared.Http --version 1.2.1
#r "nuget: AsNet.Shared.Http, 1.2.1"
#:package AsNet.Shared.Http@1.2.1
#addin nuget:?package=AsNet.Shared.Http&version=1.2.1
#tool nuget:?package=AsNet.Shared.Http&version=1.2.1
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 flexible token service designed for secured APIs and compatible with multiple OAuth2 / OpenID Connect providers.
Supported providers include:
- Duende IdentityServer
- IdentityServer4
- Azure AD / Microsoft Entra ID
- Keycloak
- Auth0
- Custom OAuth2/OpenID Connect providers
Token acquisition is grant-based and provider-driven, allowing applications to consume tokens from multiple authorization servers simultaneously.
Supported Grant Types
- Client Credentials
- Authorization Code
- Password
- On‑Behalf‑Of (OBO)
- Token Exchange
Key Types
ITokenServiceITokenProviderIOAuthProviderResolverOAuthProviderResolverTokenServiceTokenRequestContextOAuthProviderSettings
Built‑in providers:
ClientCredentialsTokenProviderAuthorizationCodeTokenProvider
Token providers are selected automatically according to the requested GrantType.
OAuth provider configuration is resolved independently through the OAuthProviderResolver service, enabling multiple authentication providers within the same application.
Provider Resolution
When requesting a token, the library can resolve OAuth provider settings using the following precedence:
- ProviderSettings (runtime override)
- ProviderName (named provider configuration)
- Default provider configuration
This allows:
- Default application authentication
- Multiple external OAuth providers
- Dynamic provider configuration loaded from databases
- Multi-tenant integrations
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>"
}
}
}
### OAuth Provider Settings
The library supports a default OAuth provider as well as multiple named
providers.
```json
{
"AsNet": {
"Security": {
"IdentityServerSettings": {
"Default": {
"Address": "https://sso.company.com",
"ClientId": "default-client",
"ClientSecret": "secret",
"Scope": "api"
},
"Providers": {
"AsNet": {
"Address": "https://sso.company.com",
"ClientId": "client1",
"ClientSecret": "secret1",
"Scope": "api"
},
"CustomerA": {
"Address": "https://auth.customera.com",
"ClientId": "client2",
"ClientSecret": "secret2",
"Scope": "documents"
},
"CustomerB": {
"Address": "https://login.customerb.com",
"ClientId": "client3",
"ClientSecret": "secret3",
"Scope": "files"
}
}
}
}
}
}
| 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.4)
- Dahomey.Cbor (>= 1.26.3)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.9)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- System.Formats.Asn1 (>= 10.0.9)
- System.Security.Cryptography.Pkcs (>= 10.0.9)
- System.Security.Cryptography.Xml (>= 10.0.9)
- System.ServiceModel.Http (>= 8.1.2)
-
net10.0
- AsNet.Shared (>= 3.2.0.4)
- Dahomey.Cbor (>= 1.26.3)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.9)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- System.Security.Cryptography.Pkcs (>= 10.0.9)
- System.Security.Cryptography.Xml (>= 10.0.9)
- System.ServiceModel.Http (>= 10.0.652802)
-
net8.0
- AsNet.Shared (>= 3.2.0.4)
- Dahomey.Cbor (>= 1.26.3)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.9)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- System.Formats.Asn1 (>= 10.0.9)
- System.Security.Cryptography.Pkcs (>= 10.0.9)
- System.Security.Cryptography.Xml (>= 10.0.9)
- System.ServiceModel.Http (>= 8.1.2)
-
net9.0
- AsNet.Shared (>= 3.2.0.4)
- Dahomey.Cbor (>= 1.26.3)
- Dahomey.Json (>= 1.12.2)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.9)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- System.Formats.Asn1 (>= 10.0.9)
- System.Security.Cryptography.Pkcs (>= 10.0.9)
- System.Security.Cryptography.Xml (>= 10.0.9)
- 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.1.2 | 124 | 9/11/2026 | |
| 1.2.1.1 | 279 | 7/9/2026 | |
| 1.2.1 | 162 | 7/6/2026 | |
| 1.2.0.4 | 534 | 5/6/2026 | |
| 1.2.0.3 | 275 | 4/7/2026 | |
| 1.2.0.2 | 170 | 4/6/2026 | |
| 1.2.0.1 | 196 | 2/8/2026 | |
| 1.2.0 | 221 | 1/13/2026 | |
| 1.1.2 | 334 | 6/30/2025 | |
| 1.1.1 | 359 | 1/6/2025 | |
| 1.1.0.5 | 311 | 12/9/2024 | |
| 1.1.0.4 | 317 | 12/9/2024 | |
| 1.1.0.3 | 325 | 11/11/2024 | |
| 1.1.0.2 | 363 | 9/6/2024 | |
| 1.1.0.1 | 323 | 6/20/2024 | |
| 1.1.0 | 318 | 6/9/2024 | |
| 1.0.7.1 | 448 | 9/29/2023 | |
| 1.0.7 | 284 | 9/28/2023 | |
| 1.0.6.10 | 290 | 9/23/2023 | |
| 1.0.6.8 | 289 | 9/23/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.