vahidn / dntcommon.web.core Goto Github PK
View Code? Open in Web Editor NEWDNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications.
License: Apache License 2.0
DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications.
License: Apache License 2.0
اما وقتی بانک اطلاعاتی رو پاک میکنم کلید جدید ساخته میشه و کلید قبلی هنوز توی کوکی ها هست و زمانی که میخوام کوکی رو بخونم خطا صادر میشه
که توی لینک زیر قبلا خطا رو گزارش دادم
آیا راهی وجود داره در صورت پاک کردن دیتابیس و ساخت مجدد آن این خطا دریافت نشه؟
یا راهی وجود داره کوکی ها رو پاک کرد؟
DNTCommon.Web.Core version: 1.8.0
.NET Core SDK version: 3.1.0
IDE: Visual Studio 16.4.0 on Windows 10
services.AddControllers();
services.AddDNTCommonWeb()
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
این تابع کجاست؟
GetAllSecuredControllerActionsWithPolicy
تعریف شده فقط پیاده سازیش رو پیدا نکردم؟
من برای ساختار چند زبانه DisplayNameAttribute رو override کردم و باتوجه به ساختار چندزبانه ازش استفاده میکنم
public class DisplayNameLocalizationAttribute : DisplayNameAttribute
اما زمانی که میخوام نام کنترلر ها رو بدست بیارم نام کنترلرها خالی می باشد
از این تابع استفاده میکنم
GetAllSecuredControllerActionsWithPolicy
InvalidOperationException: Cache entry must specify a value for Size when SizeLimit is set.
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)
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)
Avoid sending multiple forms in .NET MVC
Is there such a feature in this package?
Is it correct to use daylight saving time in the runAt method instead of the fixed number in Startup.cs?
var daylightSavingTime = month > 6 ? 3.5 : 4.5;
var now = utcNow.AddHours(daylightSavingTime);
درود
آیا امکان دارد در تنظیمات یا همان
SmtpConfig
گزینه های
bool UseSSL
bool ServerCertificateValidationCallback
اضافه شود تا بجای فراخوانی تابع با پارامترها بصورت یکپارچه این تنظیمات اعمال شود؟
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
Dear,
First of all, thanks for DNTCommon.Web.Core!
Please add CC
, BCC
and Reply-To
to IWebMailService
service.
سلام
توی فایل لاگ این بخش مرتب خطا میده
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."
}
]
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:
by calling same url Continuously, my IP banned, once in 6th request and once in 37th request but AllowedRequests is 500 !
با سلام
مقادیر مناسب برای
DurationMin و AllowedRequests
چه اعدادی هستن
زمانی که
AllowedRequests
رو مثلا به 100 برای یک دقیقه تنظیم میکنم پس از بازکردن تعداد صفحات محدودی پیغام محدودیت دیسترسی رو نشون میده
Hi dear vahid.
When i updated to new version of DNTCommon.Web.Core, it occurs exception.
DNTCommon.Web.Core version: 2.9.1
.NET Core SDK version: 5
IDE: VS 16.8.2
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)
can u help me? i tried everything about it.
method is ther i can find and useit. but in runtime i get this error
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:
paste your core code
Exception message:
Full Stack trace:
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("<A HREF=\"http://www.codeplex.com?url=¼script¾alert(¢XSS¢)¼/script¾\">XSS</A>");</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><A HREF=\"http://www.codeplex.com?url=¼script¾alert(¢XSS¢)¼/script¾\>XSS</A></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?
The in-use version:MVC core 2.2
Operating system: win 10 x64
IDE: (Visual Studio 2017)
the package Microsoft.AspNetCore.App that referenced at /src/DNTCommon.Web.Core/DNTCommon.Web.Core.csproj has been deprecated.
there is some alternative to replace?
note: i try _ and _, its work but i cant test its really work after installing DNTCommon.Web.Core?!
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
.
.
.
"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
DNTCommon.Web.Core version: 3.4.0
.NET Core SDK version: 6
IDE: Rider
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);`
<?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:
PersianDateModelBinder uses globally not work without BinderAttribute [ModelBinder(BinderType = typeof(PersianDateModelBinder))]
Also totally it doesn't bind value.
DNTCommon.Web.Core version: 2.9.2
.NET Core SDK version: 5
IDE: vs 16.8.2
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?
Is it compatibility for .Net Core 3.1?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.