DNTCommon.Web.Core 4.1.0

dotnet add package DNTCommon.Web.Core --version 4.1.0
NuGet\Install-Package DNTCommon.Web.Core -Version 4.1.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="DNTCommon.Web.Core" Version="4.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DNTCommon.Web.Core --version 4.1.0
#r "nuget: DNTCommon.Web.Core, 4.1.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 DNTCommon.Web.Core as a Cake Addin
#addin nuget:?package=DNTCommon.Web.Core&version=4.1.0

// Install DNTCommon.Web.Core as a Cake Tool
#tool nuget:?package=DNTCommon.Web.Core&version=4.1.0

DNTCommon.Web.Core

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:

Nuget

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

  • Caching

    • ICacheService encapsulates IMemoryCache functionalities.
    • [NoBrowserCache] action filter sets no-cache, must-revalidate, no-store headers for the current Response.
  • 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

  • Http

  • Mail

    • IWebMailService simplifies sending an email using the MailKit library. It's able to use razor based email templates.
  • 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))).
  • Mvc

  • Blazor

  • 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, call services.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, the order parameter's value indicates the order of their execution.
  • Security

    • [AjaxOnly] action filter determines whether the HttpRequest's X-Requested-With header has XMLHttpRequest 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() and services.Configure<AntiDosConfig> to Startup.cs file. Then complete the AntiDosConfig 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 the AntiXssConfig section of the appsettings.json file.
    • IPasswordHasherService provides a custom Pbkdf2 hashing and validating service.
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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
4.1.0 41 3/17/2024
4.0.1 53 3/17/2024
4.0.0 42 3/16/2024
3.9.2 131 3/2/2024
3.9.1 87 2/29/2024
3.9.0 168 2/18/2024
3.8.2 159 2/6/2024
3.8.1 89 1/31/2024
3.8.0 94 1/30/2024
3.7.0 375 12/28/2023
3.6.0 403 11/19/2023
3.5.5 118 11/18/2023
3.5.4 1,530 9/21/2023
3.5.3 711 8/30/2023
3.5.2 1,361 3/15/2023
3.5.1 289 3/5/2023
3.5.0 941 12/22/2022
3.4.1 1,110 11/20/2022
3.4.0 6,131 6/28/2022
3.3.1 447 6/25/2022
3.3.0 3,872 1/27/2022
3.2.1 610 12/18/2021
3.2.0 301 12/18/2021
3.1.0 447 11/28/2021
3.0.0 553 11/9/2021
2.9.5 641 10/26/2021
2.9.4 1,459 7/31/2021
2.9.3 369 7/31/2021
2.9.2 987 6/7/2021
2.9.1 2,137 2/24/2021
2.9.0 623 1/15/2021
2.8.2 466 1/8/2021
2.8.1 458 12/27/2020
2.8.0 445 12/27/2020
2.7.1 551 12/25/2020
2.7.0 431 12/24/2020
2.6.0 518 12/17/2020
2.5.0 1,584 11/23/2020
2.4.0 1,619 11/11/2020
2.3.2 696 10/17/2020
2.3.1 533 10/10/2020
2.3.0 442 10/8/2020
2.2.0 581 9/29/2020
2.1.1 904 9/12/2020
2.1.0 507 9/11/2020
2.0.0 775 9/3/2020
1.9.0 656 9/2/2020
1.8.2 2,036 6/8/2020
1.8.1 2,450 12/7/2019
1.8.0 877 10/23/2019
1.7.0 676 10/17/2019
1.6.1 872 9/24/2019
1.6.0 537 8/28/2019
1.5.1 374 8/14/2019
1.5.0 339 8/8/2019
1.4.0 7,021 3/23/2019
1.3.3 3,322 12/6/2018
1.3.2 1,371 9/20/2018
1.3.1 968 9/18/2018
1.3.0 1,555 6/7/2018
1.2.0 1,328 4/30/2018
1.1.0 1,194 4/21/2018
1.0.0 1,210 4/18/2018