Giter VIP home page Giter VIP logo

dntcommon.web.core's People

Contributors

dependabot[bot] avatar engrajabi avatar hamed-shirbandi avatar pshariiati avatar vahidn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dntcommon.web.core's Issues

DNTCommon.Web.Core.ProtectionProviderService

من وقتی یکبار پروژه رو اجرا میکنم کلید جدیدی ساخته میشه و هیچ مشکلی ندارم

اما وقتی بانک اطلاعاتی رو پاک میکنم کلید جدید ساخته میشه و کلید قبلی هنوز توی کوکی ها هست و زمانی که میخوام کوکی رو بخونم خطا صادر میشه

که توی لینک زیر قبلا خطا رو گزارش دادم

#9

آیا راهی وجود داره در صورت پاک کردن دیتابیس و ساخت مجدد آن این خطا دریافت نشه؟

یا راهی وجود داره کوکی ها رو پاک کرد؟

Error when using services.AddControllers()

Summary of the issue

Environment

DNTCommon.Web.Core version: 1.8.0
.NET Core SDK version: 3.1.0
IDE: Visual Studio 16.4.0 on Windows 10

Example code/Steps to reproduce:

services.AddControllers();
services.AddDNTCommonWeb()

Output:

Exception message:
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine' while attempting to activate 'DNTCommon.Web.Core.ViewRendererService'.
Full Stack trace:
When I Use current code in startup in my Web APi project received this exception.
services.AddControllers();
services.AddDNTCommonWeb() ;
but when I Use this Code my problem is solved.
services.AddControllersWithViews();
services.AddDNTCommonWeb() ;

my project is web api and View is not used in this project.
thanks

DisplayNameAttribute?

من برای ساختار چند زبانه DisplayNameAttribute رو override کردم و باتوجه به ساختار چندزبانه ازش استفاده میکنم

public class DisplayNameLocalizationAttribute : DisplayNameAttribute

اما زمانی که میخوام نام کنترلر ها رو بدست بیارم نام کنترلرها خالی می باشد
از این تابع استفاده میکنم
GetAllSecuredControllerActionsWithPolicy

AntiDosFirewall Error

Summary of the issue

InvalidOperationException: Cache entry must specify a value for Size when SizeLimit is set.

Error


    Microsoft.Extensions.Caching.Memory.MemoryCache.SetEntry(CacheEntry entry)
    Microsoft.Extensions.Caching.Memory.CacheEntry.Dispose()
    Microsoft.Extensions.Caching.Memory.CacheExtensions.Set<TItem>(IMemoryCache cache, object key, TItem value, DateTimeOffset absoluteExpiration)
    DNTCommon.Web.Core.MemoryCacheService.Add<T>(string cacheKey, T value, DateTimeOffset absoluteExpiration)
    DNTCommon.Web.Core.AntiDosFirewall.IsDosAttack(AntiDosFirewallRequestInfo requestInfo)
    DNTCommon.Web.Core.AntiDosFirewall.ShouldBlockClient(AntiDosFirewallRequestInfo requestInfo)
    DNTCommon.Web.Core.AntiDosMiddleware.Invoke(HttpContext context, IOptionsSnapshot<AntiDosConfig> antiDosConfig, IAntiDosFirewall antiDosFirewall)
    Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Detail Error:

System.InvalidOperationException: Cache entry must specify a value for Size when SizeLimit is set.

   at Microsoft.Extensions.Caching.Memory.MemoryCache.SetEntry(CacheEntry entry)

   at Microsoft.Extensions.Caching.Memory.CacheEntry.Dispose()

   at Microsoft.Extensions.Caching.Memory.CacheExtensions.Set[TItem](IMemoryCache cache, Object key, TItem value, DateTimeOffset absoluteExpiration)

   at DNTCommon.Web.Core.MemoryCacheService.Add[T](String cacheKey, T value, DateTimeOffset absoluteExpiration)

   at DNTCommon.Web.Core.AntiDosFirewall.IsDosAttack(AntiDosFirewallRequestInfo requestInfo)

   at DNTCommon.Web.Core.AntiDosFirewall.ShouldBlockClient(AntiDosFirewallRequestInfo requestInfo)

   at DNTCommon.Web.Core.AntiDosMiddleware.Invoke(HttpContext context, IOptionsSnapshot`1 antiDosConfig, IAntiDosFirewall antiDosFirewall)

   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

ServerCertificateValidationCallback در smtpConfig

درود
آیا امکان دارد در تنظیمات یا همان
SmtpConfig
گزینه های
bool UseSSL
bool ServerCertificateValidationCallback
اضافه شود تا بجای فراخوانی تابع با پارامترها بصورت یکپارچه این تنظیمات اعمال شود؟

string to razor page

hi i was looking at IViewRendererService in your code
is there any way to compile an string containing html tag and asp.net core tag helper to cimpiled razor view?
i searched net for solution long time i found this package that do compline string html tag to razor view but doesnt support tag helper yet
https://github.com/toddams/RazorLight

DNTCommon.Web.Core.ProtectionProviderService

سلام
توی فایل لاگ این بخش مرتب خطا میده
The key Invalid protected payload. Fall through. was not found in the key ring.
[
{
"Key": "e52974eb-b2e5-4ad0-8b8f-d6092646beda",
"Value": "Invalid protected payload. Fall through."
},
{
"Key": "{OriginalFormat}",
"Value": "The key {e52974eb-b2e5-4ad0-8b8f-d6092646beda} was not found in the key ring."
}
]

AntiDosMiddleware does not work as expected

I use this AntiDosMiddleware in my app and it seems to not work fine yet.
this middleware ban request out of allowed requests count defined in appsettings.json

I added a db log and this is the result:

untitled

by calling same url Continuously, my IP banned, once in 6th request and once in 37th request but AllowedRequests is 500 !

مقادیر مناسب DurationMin و AllowedRequests در UseAntiDos

با سلام

مقادیر مناسب برای
DurationMin و AllowedRequests
چه اعدادی هستن
زمانی که
AllowedRequests
رو مثلا به 100 برای یک دقیقه تنظیم میکنم پس از بازکردن تعداد صفحات محدودی پیغام محدودیت دیسترسی رو نشون میده

DateTimeModelBinder Exception

Summary of the issue

Hi dear vahid.
When i updated to new version of DNTCommon.Web.Core, it occurs exception.

Environment

DNTCommon.Web.Core version: 2.9.1
.NET Core SDK version: 5 
IDE: VS 16.8.2

Example code/Steps to reproduce:

Your Test WebApp

Exception message:
Full Stack trace:
System.MissingMethodException: Method not found: 'System.Nullable`1<System.DateTime> DNTPersianUtils.Core.PersianDateTimeUtils.ToGregorianDateTime(System.String, Boolean)'.
   at DNTCommon.Web.Core.PersianDateModelBinder.BindModelAsync(ModelBindingContext bindingContext)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder.BindModelAsync(ModelBindingContext bindingContext)
   at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value, Object container)
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

1
2

Method not found: 'System.Threading.Tasks.Task DNTCommon.Web.Core.IWebMailService.SendEmailAsync'

Summary of the issue

can u help me? i tried everything about it.
method is ther i can find and useit. but in runtime i get this error

Environment

    public Task SendEmailAsync(string email, string subject, string message)
    {
        return _webMailService.SendEmailAsync(
            _smtpConfig.Value,
            new[] { new MailAddress { ToName = "", ToAddress = email }, },
            subject,
            message
        );
    }
DNTCommon.Web.Core version:  latest
.NET Core SDK version: 
IDE: 

Example code/Steps to reproduce:

paste your core code

Output:

Exception message:
Full Stack trace:

Sanitized html from tinymCE

Summary of the issue

Hello and thanks for sharing your knowledge,
I try to use AntiXss, Set appsetings.json the same as this project add codes in startup,
Two line for get configuration data from appseting and one for add this service ,
another hand i have a tinyMCE for get data from my blog when run my project i got the same as paste

<html>
<head>
</head>
<body><p>_antiXssService.GetSanitizedHtml("&lt;A HREF=\"http://www.codeplex.com?url=&frac14;script&frac34;alert(&cent;XSS&cent;)&frac14;/script&frac34;\"&gt;XSS&lt;/A&gt;");</p></body>
</html>

test many way: past this code(Html code) on your project but get the same as my project without remove tags

<!DOCTYPE html><html><head></head><body><div>&lt;A HREF=\"http://www.codeplex.com?url=&frac14;script&frac34;alert(&cent;XSS&cent;)&frac14;/script&frac34;\&gt;XSS&lt;/A&gt;</div></body></html>

and show return value on Mvc Page as @html.row(...) , => show orginal text with out clean text
is tahat my mistake to do something?

Environment

The in-use version:MVC core 2.2
Operating system: win 10 x64
IDE: (Visual Studio 2017)


AntiDosMiddleware blocks the requests out of the defined config

I use AntiDosMiddleware in my app and it seems to not work correctly.
Some times when i try to call an api from my app, i get 409 error, but that request is not out of the AllowedRequests that defined in appsettings.json !

I set AllowedRequests to 50 requests per 1 minute and some times my request blocked at 1-10 !

.NET Core 2.1
Windows Server 2012 R2
Visual Studio 2017 5.7.6

AntiDosConfig in appsettings.json:

.
.
.
    "BannedIPAddressRanges": [
      // Some samples. Remove them!
      // "192.168.0.0/255.255.255.0", // From "192.168.0.0" to "192.168.0.255"
      // "192.168.0.10 - 192.168.10.20" // From "192.168.0.10" to "192.168.10.20"
      // More samples: https://github.com/jsakamoto/ipaddressrange
    ],
    "DurationMin": 1,
    "AllowedRequests": 50,
    "ErrorMessage": "<html><head><title>Error !</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><div style='border-color: gray; border-width: 1pt; border-style:solid'><div align='center' style='font-family: Tahoma; font-size: 9pt; direction: rtl; background:#B6B66B'><br /><span style='color:white'>Please come back later!</span><br /><br /></div></div></body></html>",
    "IgnoreLocalHost": true
.
.
.

Rss Items Not Showing

Summary of the issue

rss items not showing

Environment

DNTCommon.Web.Core version: 3.4.0
.NET Core SDK version: 6
IDE: Rider

Example code/Steps to reproduce:

var groups = _uow.Set<ProductGroup>()
                .OrderByDescending(x=>x.Id)
                .Skip(0)
                .Take(10)
                .ToList();

            var list = new List<FeedItem>();

            foreach (var group in groups)
            {
                list.Add(new FeedItem()
                {
                    Title = group.Name,
                    Content = group.Description,
                    Url = "http://www.helpdesk2.ir/"+group.Name,
                    AuthorName = "HelpDesk Writer",
                    PublishDate =group.CreationDate,
                    LastUpdatedTime = group.ModificationDate.HasValue?group.ModificationDate.Value:group.CreationDate
                });
            }
            
            var feedChannel = new FeedChannel()
            {
                CultureName = "fa-Ir",
                FeedTitle = "HelpDesk2 Shop",
                FeedDescription = "خرید انواع تجهیزات دیجیتال",
                FeedCopyright = "HelpDesk2.ir",
                RssItems = list
            };

            return new FeedResult(feedChannel);`

Output:

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" version="2.0">
  <channel>
  <description>‫خرید انواع تجهیزات دیجیتال</description>
  <copyright>HelpDesk2.ir</copyright>
  <title>HelpDesk2 Shop</title>
  <language>fa-IR</language><atom:link href="https://localhost:5001/feed/rss" rel="self" type="application/rss+xml" />
  <link>https://localhost:5001/</link></channel>
</rss>

Exception message:
Full Stack trace:


When PersianDateModelBinder added globaly, it doesn't work

Summary of the issue

PersianDateModelBinder uses globally not work without BinderAttribute [ModelBinder(BinderType = typeof(PersianDateModelBinder))]
Also totally it doesn't bind value.

Environment

DNTCommon.Web.Core version: 2.9.2
.NET Core SDK version: 5
IDE: vs 16.8.2

Download file from URL and save on user disk

Hello.
How about downloading file from URL by IDownloadService.cs on user disk.
I have a website that provides files to download but my files are on download host, i dont want to user see original download link.
How should i use your package?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.