Skip to content

DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core 1.1.x and 2.x applications.

License

Notifications You must be signed in to change notification settings

z-saffarpour/DNTCommon.Web.Core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNTCommon.Web.Core

DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core 1.1.x and 2.x 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.

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. Its 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))].
  • Mvc

  • 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.

About

DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core 1.1.x and 2.x applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.7%
  • Other 0.3%