اشتراک‌ها
شروع به کار با SignalR Core

At this moment, there is a 0.2.0 alpha version of Microsoft.AspNetCore.SignalR.Server that makes it possible to use SignalR with an ASP.NET Core application 

شروع به کار با SignalR Core
اشتراک‌ها
وضعیت WebAssembly در 2021 و 2022

2021 was no exception and the following are some of the new areas where you’ll now find WebAssembly

وضعیت WebAssembly در 2021 و 2022
مطالب
امن سازی درخواست‌های ای‌جکسی برنامه‌های ASP.NET MVC 5.x در مقابل حملات CSRF

طی مقاله چک لیست تولید برنامه Asp.net mvc و بررسی امنیتی ای‌جکس هنگام استفاده در مورد چک لیست امنیتی سایت سرفصل‌های مهم عنوان و بررسی شده است که یکی از موارد، مقاوم ساختن وب اپلیکشن در برابر حملات CSRF می‌باشد. اینگونه حملات بر پایه این استراتژی شکل می‌گیرند که با ارسال درخواستی به نیابت از سمت سیستم/مرورگر کاربر تایید هویت شده، سایت مقصد را مجبور به انجام عملی کند. برای مثال اگر شما در سایت a.com یک کاربر تایید شده باشید و هم اکنون در سایت فوق نیز لاگین باشید، مهاجم با ارسال یک برنامه/صفحه یا موارد مشابه و در قالب src یک عکس یا با ترغیب شما با کلیک بر روی یک لینک با href آلوده یا موارد مشابه، از سمت مرورگر شما درخواستی را به سمت سایت a.com ارسال می‌کند .

این درخواست ممکن است شامل حذف اطلاعات، تغییر مشخصات، پرداخت هزینه یا موارد مشابه باشد. جهت مقابله با این حمله، یکی از موارد مهم، استفاده همیشگی از Html.AntiForgeryToken() در تمامی فرم‌های ورود اطلاعات است. همچنین استفاده همیشگی از متد Post و بررسی تایید مبدا درخواست‌های ای‌جکسی، بررسی http referrer ، محدود کردن طول عمر کوکی، استفاده از کپچهای قوی مانند کپچای گوگل می‌تواند تا حد زیادی وب اپلیکیشن را در مورد اینگونه حملات، مصون کند.

در این بین یکی از موارد دیگر، اضافه کردن AntiForgeryToken به درخواست‌های ا‌ی‌جکسی سایت می‌باشد. جهت حصول این منظور، راه‌های مختلفی موجود است. یکی از راه حل‌ها استفاده از یک هلپر جهت تولید توکن مورد نظر است.

ساختار هلپر مورد نظر به شرح زیر است :

public static class AntiForgeryToken
{
  public static MvcHtmlString AntiForgeryTokenForAjaxPost(this HtmlHelper helper)
  {
    var antiForgeryInputTag = helper.AntiForgeryToken().ToString();
    // Above gets the following: <input name="__RequestVerificationToken" type="hidden" value="some value" />
    var removedStart = antiForgeryInputTag.Replace(@"<input name=""__RequestVerificationToken"" type=""hidden"" value=""", "");
    var tokenValue = removedStart.Replace(@""" />", "");
    if (antiForgeryInputTag == removedStart || removedStart == tokenValue)
       throw new InvalidOperationException("Oops! The Html.AntiForgeryToken() method seems to return something I did not expect.");
    return new MvcHtmlString($@"{"__RequestVerificationToken"}:""{tokenValue}""");
  }
}
کار آن حذف فیلد مخفی این توکن و درج آن به صورت یک شیء جاوا اسکریپتی است. 

در مرحله بعد طبق الگوی زیر، درخواست ا‌ی‌جکسی به همراه توکن تولید شده و به کنترلر ارسال خواهد شد:
function AddToCart(pid) {
   $.ajax({
     url: '@Url.Action("AddToBasket","Shop")',
     data: { 'pid': pid,@Html.AntiForgeryTokenForAjaxPost()  },
     type: 'post',
     success:function(e) {
       //do something
     }
   });
}

در مرحله آخر، باید کنترلر مورد نظر شامل ویژگی‌های [HttpPost] [ValidateAntiForgeryToken]  باشد تا صحت توکن تولیدی را بررسی کند و در صورت نامعتبر بودن، از اجرای دستورات جلوگیری گردد.
اشتراک‌ها
خلاصه‌ای از آمارهای بررسی محبوب‌ترین زبان‌های برنامه نویسی در سال 2024

The most popular programming languages in 2024 (and what that even means)

We aggregated data from nine different rankings to produce the ZDNET Index of Programming Language Popularity. Here's which languages came out on top and what to make of this information.

خلاصه‌ای از آمارهای بررسی محبوب‌ترین زبان‌های برنامه نویسی در سال 2024
اشتراک‌ها
ایده گرفتن از قسمت‌های خوب Domain Driven Design

Domain Driven Design: The Good Parts

The greenfield project started out so promising. Instead of devolving into big ball of mud, the team decided to apply domain-driven design principles. Ubiquitous language, proper boundaries, encapsulation, it all made sense.
But along the way, something went completely and utterly wrong. It started with arguments on the proper way of implementing aggregates and entities. Arguments began over project and folder structure. Someone read a blog post that repositories are evil, and ORMs the devil incarnate. Another read that relational databases are last century, we need to store everything as a stream of events. Then came the actor model and frameworks that sounded like someone clearing their throat. Instead of a nice, clean architecture, the team chased the next new approach without ever actually shipping anything.
Beyond the endless technical arguments it causes, domain-driven design can actually produce great software. We have to look past the hype into the true value of DDD, what it can bring to our organizations and how it can enable us to build quality systems. With the advent of microservices, DDD is more important than ever - but only if we can get to the good parts. 

ایده گرفتن از قسمت‌های خوب Domain Driven Design
اشتراک‌ها
5 آنتی ویروس رایگان برای ویندوز

Hackers are smart and users are not being able to cope with their pace of evolution. The result is malware outbreaks we get to know about frequently. Windows is the most widely used OS on Pcs. That makes it the most widely targeted OS too. What is an average user’s (by average I mean not too technical)  defense in such case? The anti malware programs. Of course, you have to pay a decent price for your PC to be secured from latest malware derivatives, but what’s better than to get the security for no cost? 

5 آنتی ویروس رایگان برای ویندوز
اشتراک‌ها
کتاب رایگان MongoDB 3 Succinctly

MongoDB is one of the biggest players in the NoSQL database market, providing high performance, high availability, and automatic scaling. It’s an open-source document database written in C++ and hosted on GitHub. Zoran Maksimovic’s MongoDB 3 Succinctly touches on the most important aspects of the MongoDB database that application developers should be aware of—from installation and the usage of the Mongo Shell, to examples of the MongoDB C# driver APIs for Microsoft .NET Framework.

Table of Contents

  1. MongoDB Overview
  2. MongoDB Installation
  3. The Mongo Shell
  4. Manipulating Documents
  5. Data Retrieval
  6. Basic MongoDB with C#
  7. Data Handling in C#
  8. Inserting Data in C#
  9. Find (Query) Data in C#
  10. Binary Data (File Handling) in C#
  11. Back Up and Restore 
کتاب رایگان MongoDB 3 Succinctly
اشتراک‌ها
کتابخانه loadCSS

A function for loading CSS asynchronously

Why loadCSS?

Referencing CSS stylesheets with link[rel=stylesheet] or @import causes browsers to delay page rendering while a stylesheet loads. When loading stylesheets that are not critical to the initial rendering of a page, this blocking behavior is undesirable. The new <link rel="preload"> standard enables us to load stylesheets asynchronously, without blocking rendering, and loadCSS provides a JavaScript polyfill for that feature to allow it to work across browsers. Additionally, loadCSS offers a separate (and optional) JavaScript function for loading stylesheets dynamically.

npm install fg-loadcss --save

کتابخانه loadCSS
اشتراک‌ها
React چگونه کار میکند ؟

My goal here is to walk through my process of building react from the groundup, hopefully giving you an intuition to why things behave the way they do in react.

React چگونه کار میکند ؟