DNTCommon.Web.Core
7.8.0
See the version list below for details.
dotnet add package DNTCommon.Web.Core --version 7.8.0
NuGet\Install-Package DNTCommon.Web.Core -Version 7.8.0
<PackageReference Include="DNTCommon.Web.Core" Version="7.8.0" />
paket add DNTCommon.Web.Core --version 7.8.0
#r "nuget: DNTCommon.Web.Core, 7.8.0"
// Install DNTCommon.Web.Core as a Cake Addin #addin nuget:?package=DNTCommon.Web.Core&version=7.8.0 // Install DNTCommon.Web.Core as a Cake Tool #tool nuget:?package=DNTCommon.Web.Core&version=7.8.0
DNTCommon.Web.Core
DNTCommon.Web.Core
provides common scenarios' solutions for ASP.NET Core applications.
Install via NuGet
To install DNTCommon.Web.Core, run the following command in the Package Manager Console:
PM> Install-Package DNTCommon.Web.Core
You can also view the package page on NuGet.
Linux (and containers) support
The SkiaSharp
library needs extra dependencies to work on Linux and containers. Please install the following NuGet
packages:
PM> Install-Package SkiaSharp.NativeAssets.Linux.NoDependencies
PM> Install-Package HarfBuzzSharp.NativeAssets.Linux
You also need to modify your .csproj
file to include some MSBuild directives that ensure the required files are in a
good place. These extra steps are normally not required but seems to be some issues on how .NET loads them.
<Target Name="CopyFilesAfterPublish" AfterTargets="AfterPublish">
<Copy SourceFiles="$(TargetDir)runtimes/linux-x64/native/libSkiaSharp.so" DestinationFolder="$([System.IO.Path]::GetFullPath('$(PublishDir)'))/bin/" />
<Copy SourceFiles="$(TargetDir)runtimes/linux-x64/native/libHarfBuzzSharp.so" DestinationFolder="$([System.IO.Path]::GetFullPath('$(PublishDir)'))/bin/" />
</Target>
Usage
After installing the DNTCommon.Web.Core package, to register its default providers, call services.AddDNTCommonWeb();
method in
your Startup class.
using DNTCommon.Web.Core;
namespace MyWebApp
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddDNTCommonWeb();
}
Features
ActionResults
- FeedResult is an ASP.NET Core RSS feed renderer.
- OpenSearchResult is an ASP.NET Core OpenSearch description format provider.
- SitemapResult is an ASP.NET Core Sitemap renderer.
Caching
- ICacheService encapsulates IMemoryCache functionalities.
- [NoBrowserCache]
action filter sets
no-cache
,must-revalidate
,no-store
headers for the currentResponse
.
DependencyInjection
- IServiceProviderExtensions creates an IServiceScope which contains an IServiceProvider used to resolve dependencies from a newly created scope and then runs an associated callback.
Drawing
- TextToImageExtensions and TextToImageResult draw a text on a bitmap and then return it as a png byte array.
Http
- ICommonHttpClientFactory service, reuses a single HttpClient instance across a multi-threaded application.
- DomainHelperExtensions provides useful extension methods to extract domain info of the URL's.
- IDownloaderService encapsulates HttpClient's best practices of downloading large files.
- IHtmlHelperService provides helper methods to work with HTML contents such as extracting links and titles or changing relative Urls to absolute Urls.
- IHttpRequestInfoService provides useful methods to work with current HttpContext.Request.
- IRedirectUrlFinderService finds the actual hidden URL after multiple redirects.
- IUrlNormalizationService transforms a URL into a normalized URL so it is possible to determine if two syntactically different URLs may be equivalent.
- IHtmlReaderService reads the HTML document's nodes recursively.
IUAParserService
is the updated version of the UAParser library with the latest regexes.yaml file.
Mail
- IWebMailService
simplifies sending an email using the
MailKit
library. It's able to use razor based email templates.
- IWebMailService
simplifies sending an email using the
ModelBinders
- PersianDateModelBinderProvider
parses an incoming Persian date and then binds it to a DateTime property automatically. To use it globally (
assuming your app only sends Persian dates to the server), Add it to
MvcOptions:
services.AddMvc(options => options.UsePersianDateModelBinder())
or just apply it to an specific view-model[ModelBinder(BinderType = typeof(PersianDateModelBinder))]
. - YeKeModelBinderProvider
parses an incoming text and then corrects its Ye & Ke characters automatically. To use it globally, Add it to
MvcOptions:
services.AddMvc(options => options.UseYeKeModelBinder())
or just apply it to an specific view-model[ModelBinder(BinderType = typeof(YeKeModelBinder))]
. - ApplyCorrectYeKeFilterAttribute
parses an incoming text and then corrects its Ye & Ke characters automatically. To use it globally, Add it to
MvcOptions:
services.AddControllersWithViews(options => options.Filters.Add(typeof(ApplyCorrectYeKeFilterAttribute)))
.
- PersianDateModelBinderProvider
parses an incoming Persian date and then binds it to a DateTime property automatically. To use it globally (
assuming your app only sends Persian dates to the server), Add it to
MvcOptions:
Mvc
- ControllerExtensions provides useful extension methods to work with MVC Controllers.
- IMvcActionsDiscoveryService provides a way to list all of the controllers and action methods of an MVC application.
- IViewRendererService helps rendering a .cshtml file as an string. It's useful for creating razor based email templates.
- UploadFileService saves the posted IFormFile to the specified directory asynchronously.
Blazor
- IBlazorStaticRendererService helps rendering a razor component as an string. It's useful for creating razor based email templates.
- IBlazorRenderingContext helps detecting the current rendering mode of a razor component.
Schedulers
- BackgroundQueueController
A .NET Core replacement for the old
HostingEnvironment.QueueBackgroundWorkItem
method. - ScheduledTasksController
DNTScheduler.Core is a lightweight ASP.NET Core's background tasks runner and scheduler. To define a new
task, create a new class
that implements the
IScheduledTask
interface. To register this new task, callservices.AddDNTScheduler();
method in your Startup class.AddDNTScheduler
method, adds this new task to the list of the defined tasks. Also its first parameter defines the custom logic of the running intervals of this task. It's a callback method that will be called every second and provides the utcNow value. If it returns true, the job will be executed.If you have multiple jobs at the same time, theorder
parameter's value indicates the order of their execution.
- BackgroundQueueController
A .NET Core replacement for the old
Security
- [AjaxOnly]
action filter determines whether the HttpRequest's
X-Requested-With
header hasXMLHttpRequest
value. - IProtectionProviderService
is an encryption provider based on
Microsoft.AspNetCore.DataProtection.IDataProtector
. It's only useful for short-term encryption scenarios such as creating encrypted HTTP cookies. - IFileNameSanitizerService
determines whether the requested file is safe to download to avoid
Directory Traversal
&File Inclusion
attacks. - UploadFileExtensions attribute determines only selected file extensions are safe to be uploaded.
- AllowUploadSafeFiles attribute disallows uploading dangerous files such as .aspx, web.config and .asp files.
- AntiDosMiddleware
is a rate limiter and throttling middleware for ASP.NET Core apps. To use it first add
app.UseAntiDos()
andservices.Configure<AntiDosConfig>
to Startup.cs file. Then complete theAntiDosConfig
section of the appsettings.json file. - IAntiXssService
provides a cleaning service for unsafe HTML fragments that can lead to XSS attacks based on a whitelist of allowed
tags and attributes. To use it add
services.Configure<AntiXssConfig>
to Startup.cs file. Then complete theAntiXssConfig
section of the appsettings.json file. - IPasswordHasherService provides a custom Pbkdf2 hashing and validating service.
- [AjaxOnly]
action filter determines whether the HttpRequest's
Product | Versions 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 is compatible. 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. |
-
net6.0
- AsyncKeyedLock (>= 7.1.4)
- Ben.Demystifier (>= 0.4.1)
- DNTPersianUtils.Core (>= 6.3.2)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.0)
- HtmlAgilityPack (>= 1.11.71)
- IPAddressRange (>= 6.1.0)
- MailKit (>= 4.8.0)
- Microsoft.Extensions.Http.Polly (>= 6.0.0)
- NetEscapades.AspNetCore.SecurityHeaders (>= 0.24.0)
- SkiaSharp (>= 3.116.0)
- SkiaSharp.HarfBuzz (>= 3.116.0)
- SkiaSharp.NativeAssets.Linux (>= 3.116.0)
- System.IO.Hashing (>= 8.0.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- UAParser (>= 3.1.47)
-
net7.0
- AsyncKeyedLock (>= 7.1.4)
- Ben.Demystifier (>= 0.4.1)
- DNTPersianUtils.Core (>= 6.3.2)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.0)
- HtmlAgilityPack (>= 1.11.71)
- IPAddressRange (>= 6.1.0)
- MailKit (>= 4.8.0)
- Microsoft.Extensions.Http.Polly (>= 7.0.0)
- NetEscapades.AspNetCore.SecurityHeaders (>= 0.24.0)
- SkiaSharp (>= 3.116.0)
- SkiaSharp.HarfBuzz (>= 3.116.0)
- SkiaSharp.NativeAssets.Linux (>= 3.116.0)
- System.IO.Hashing (>= 8.0.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- UAParser (>= 3.1.47)
-
net8.0
- AsyncKeyedLock (>= 7.1.4)
- Ben.Demystifier (>= 0.4.1)
- DNTPersianUtils.Core (>= 6.3.2)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.0)
- HtmlAgilityPack (>= 1.11.71)
- IPAddressRange (>= 6.1.0)
- MailKit (>= 4.8.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.0)
- NetEscapades.AspNetCore.SecurityHeaders (>= 0.24.0)
- SkiaSharp (>= 3.116.0)
- SkiaSharp.HarfBuzz (>= 3.116.0)
- SkiaSharp.NativeAssets.Linux (>= 3.116.0)
- System.IO.Hashing (>= 8.0.0)
- System.ServiceModel.Syndication (>= 8.0.0)
- UAParser (>= 3.1.47)
-
net9.0
- AsyncKeyedLock (>= 7.1.4)
- Ben.Demystifier (>= 0.4.1)
- DNTPersianUtils.Core (>= 6.3.2)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.0)
- HtmlAgilityPack (>= 1.11.71)
- IPAddressRange (>= 6.1.0)
- MailKit (>= 4.8.0)
- Microsoft.Extensions.Http.Polly (>= 9.0.0)
- NetEscapades.AspNetCore.SecurityHeaders (>= 0.24.0)
- SkiaSharp (>= 3.116.0)
- SkiaSharp.HarfBuzz (>= 3.116.0)
- SkiaSharp.NativeAssets.Linux (>= 3.116.0)
- System.IO.Hashing (>= 9.0.0)
- System.ServiceModel.Syndication (>= 9.0.0)
- UAParser (>= 3.1.47)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on DNTCommon.Web.Core:
Repository | Stars |
---|---|
VahidN/DNTIdentity
A highly customized sample of the ASP.NET Core Identity
|
Version | Downloads | Last updated |
---|---|---|
8.2.0 | 38 | 12/22/2024 |
8.1.0 | 26 | 12/22/2024 |
8.0.0 | 33 | 12/22/2024 |
7.9.11 | 53 | 12/21/2024 |
7.9.10 | 80 | 12/20/2024 |
7.9.9 | 46 | 12/19/2024 |
7.9.8 | 32 | 12/19/2024 |
7.9.7 | 63 | 12/18/2024 |
7.9.6 | 40 | 12/18/2024 |
7.9.5 | 114 | 12/17/2024 |
7.9.4 | 93 | 12/16/2024 |
7.9.3 | 100 | 12/15/2024 |
7.9.2 | 82 | 12/15/2024 |
7.9.1 | 82 | 12/14/2024 |
7.9.0 | 145 | 12/10/2024 |
7.8.1 | 154 | 12/6/2024 |
7.8.0 | 121 | 12/4/2024 |
7.7.0 | 148 | 12/1/2024 |
7.6.9 | 145 | 11/28/2024 |
7.6.8 | 349 | 11/19/2024 |
7.6.7 | 153 | 11/17/2024 |
7.6.6 | 81 | 11/17/2024 |
7.6.5 | 89 | 11/17/2024 |
7.6.4 | 83 | 11/17/2024 |
7.6.3 | 131 | 11/15/2024 |
7.6.2 | 113 | 11/13/2024 |
7.6.1 | 185 | 11/10/2024 |
7.6.0 | 116 | 11/9/2024 |
7.5.0 | 116 | 11/8/2024 |
7.4.0 | 92 | 11/8/2024 |
7.3.0 | 97 | 11/7/2024 |
7.2.0 | 129 | 10/31/2024 |
7.1.0 | 226 | 10/17/2024 |
7.0.0 | 116 | 10/15/2024 |
6.9.3 | 118 | 10/14/2024 |
6.9.2 | 89 | 10/14/2024 |
6.9.1 | 97 | 10/13/2024 |
6.9.0 | 98 | 10/13/2024 |
6.8.3 | 130 | 10/9/2024 |
6.8.2 | 98 | 10/9/2024 |
6.8.1 | 106 | 10/6/2024 |
6.8.0 | 149 | 10/1/2024 |
6.7.0 | 219 | 9/22/2024 |
6.6.2 | 109 | 9/21/2024 |
6.6.1 | 191 | 9/17/2024 |
6.6.0 | 154 | 9/15/2024 |
6.5.1 | 173 | 9/15/2024 |
6.5.0 | 110 | 9/15/2024 |
6.4.0 | 309 | 9/8/2024 |
6.3.1 | 179 | 8/30/2024 |
6.3.0 | 215 | 8/27/2024 |
6.2.1 | 221 | 8/21/2024 |
6.2.0 | 605 | 8/18/2024 |
6.1.0 | 121 | 8/17/2024 |
6.0.3 | 122 | 8/17/2024 |
6.0.2 | 152 | 8/16/2024 |
6.0.1 | 150 | 8/14/2024 |
6.0.0 | 144 | 8/13/2024 |
5.9.2 | 178 | 8/8/2024 |
5.9.1 | 90 | 8/5/2024 |
5.9.0 | 85 | 8/2/2024 |
5.8.0 | 101 | 7/31/2024 |
5.7.0 | 66 | 7/31/2024 |
5.6.2 | 95 | 7/29/2024 |
5.6.1 | 84 | 7/29/2024 |
5.6.0 | 100 | 7/29/2024 |
5.5.0 | 148 | 7/26/2024 |
5.4.0 | 135 | 7/25/2024 |
5.3.7 | 247 | 7/6/2024 |
5.3.6 | 221 | 6/29/2024 |
5.3.5 | 103 | 6/29/2024 |
5.3.4 | 561 | 6/25/2024 |
5.3.3 | 306 | 6/3/2024 |
5.3.2 | 127 | 6/2/2024 |
5.3.1 | 109 | 6/2/2024 |
5.3.0 | 202 | 5/12/2024 |
5.2.0 | 114 | 5/11/2024 |
5.1.0 | 132 | 5/9/2024 |
5.0.0 | 180 | 4/29/2024 |
4.9.0 | 148 | 4/25/2024 |
4.8.0 | 134 | 4/23/2024 |
4.7.2 | 117 | 4/22/2024 |
4.7.1 | 129 | 4/22/2024 |
4.7.0 | 126 | 4/22/2024 |
4.6.0 | 157 | 4/15/2024 |
4.5.0 | 145 | 4/13/2024 |
4.3.1 | 290 | 4/9/2024 |
4.3.0 | 146 | 4/5/2024 |
4.2.1 | 215 | 3/27/2024 |
4.2.0 | 125 | 3/27/2024 |
4.1.0 | 210 | 3/17/2024 |
4.0.1 | 148 | 3/17/2024 |
4.0.0 | 132 | 3/16/2024 |
3.9.2 | 196 | 3/2/2024 |
3.9.1 | 134 | 2/29/2024 |
3.9.0 | 429 | 2/18/2024 |
3.8.2 | 204 | 2/6/2024 |
3.8.1 | 137 | 1/31/2024 |
3.8.0 | 143 | 1/30/2024 |
3.7.0 | 600 | 12/28/2023 |
3.6.0 | 570 | 11/19/2023 |
3.5.5 | 155 | 11/18/2023 |
3.5.4 | 2,165 | 9/21/2023 |
3.5.3 | 830 | 8/30/2023 |
3.5.2 | 1,827 | 3/15/2023 |
3.5.1 | 333 | 3/5/2023 |
3.5.0 | 1,024 | 12/22/2022 |
3.4.1 | 1,959 | 11/20/2022 |
3.4.0 | 7,069 | 6/28/2022 |
3.3.1 | 479 | 6/25/2022 |
3.3.0 | 4,654 | 1/27/2022 |
3.2.1 | 661 | 12/18/2021 |
3.2.0 | 332 | 12/18/2021 |
3.1.0 | 484 | 11/28/2021 |
3.0.0 | 607 | 11/9/2021 |
2.9.5 | 699 | 10/26/2021 |
2.9.4 | 1,512 | 7/31/2021 |
2.9.3 | 409 | 7/31/2021 |
2.9.2 | 1,029 | 6/7/2021 |
2.9.1 | 2,294 | 2/24/2021 |
2.9.0 | 675 | 1/15/2021 |
2.8.2 | 512 | 1/8/2021 |
2.8.1 | 496 | 12/27/2020 |
2.8.0 | 477 | 12/27/2020 |
2.7.1 | 584 | 12/25/2020 |
2.7.0 | 464 | 12/24/2020 |
2.6.0 | 559 | 12/17/2020 |
2.5.0 | 1,655 | 11/23/2020 |
2.4.0 | 1,674 | 11/11/2020 |
2.3.2 | 734 | 10/17/2020 |
2.3.1 | 577 | 10/10/2020 |
2.3.0 | 474 | 10/8/2020 |
2.2.0 | 619 | 9/29/2020 |
2.1.1 | 951 | 9/12/2020 |
2.1.0 | 541 | 9/11/2020 |
2.0.0 | 813 | 9/3/2020 |
1.9.0 | 808 | 9/2/2020 |
1.8.2 | 2,421 | 6/8/2020 |
1.8.1 | 2,585 | 12/7/2019 |
1.8.0 | 918 | 10/23/2019 |
1.7.0 | 710 | 10/17/2019 |
1.6.1 | 923 | 9/24/2019 |
1.6.0 | 576 | 8/28/2019 |
1.5.1 | 398 | 8/14/2019 |
1.5.0 | 361 | 8/8/2019 |
1.4.0 | 8,003 | 3/23/2019 |
1.3.3 | 3,737 | 12/6/2018 |
1.3.2 | 1,449 | 9/20/2018 |
1.3.1 | 1,048 | 9/18/2018 |
1.3.0 | 1,610 | 6/7/2018 |
1.2.0 | 1,391 | 4/30/2018 |
1.1.0 | 1,237 | 4/21/2018 |
1.0.0 | 1,438 | 4/18/2018 |