اشتراک‌ها
استفاده از gulp و grunt در mvc 6

Bundling and minification is an important optimization technique for managing scripts and stylesheets in any web application. ASP.NET 5 and MVC6 take a different approach than previous versions to solving this problem. In this post I will illustrate the new approach using a simple example. 

استفاده از gulp و grunt در mvc 6
اشتراک‌ها
5.Visual Studio 2017 15.9 منتشر شد

These are the customer-reported issues addressed in 15.9.5:

Security Advisory Notices

5.Visual Studio 2017 15.9 منتشر شد
اشتراک‌ها
پیاده سازی یک پروژه با ASP.NET Core Web API و Angular

Learn FULL STACK Web Development in 2 HOURS! ASP.NET & Angular

Timestamps:
00:00:00 Welcome to our 2 hour FULL STACK Course!
00:01:12 What you will learn during the next 2 hours
00:03:29 Day 1 Multi-Page and Single-Page Applications, TypeScript, and Angular Components
00:21:57 Day 2 One-Way Binding and Event Binding in Angular
00:34:23 Day 3 Our Flight Booking Portal and routing in Angular
00:44:52 Day 4 The 'Search Flight' page, Design a HTML page, install Font Awesome using Node, and TypeScript interfaces
01:27:00 Day 5 ASP.NET Core REST API, SWAGGER for documenting and testing our API
01:55:51 Thanks for watching!
 

پیاده سازی یک پروژه با ASP.NET Core Web API و Angular
اشتراک‌ها
دات نت پایه، سی شارپ 8.0 و Nullable Reference Types

Here are some of the reasons why nullable reference types are less than ideal:

  • Invoking a member on a null value will issue a System.NullReferenceException exception, and every invocation that results in a System.NullReferenceException in production code is a bug. Unfortunately, however, with nullable reference types we “fall in” to doing the wrong thing rather than the right thing. The “fall in” action is to invoke a reference type without checking for null.
  • There’s an inconsistency between reference types and value types (following the introduction of Nullable<T>) in that value types are nullable when decorated with  “?” (for example, int? number); otherwise, they default to non-nullable. In contrast, reference types are nullable by default. This is “normal” to those of us who have been programming in C# for a long time, but if we could do it all over, we’d want the default for reference types to be non-nullable and the addition of a “?” to be an explicit way to allow nulls.
  • It’s not possible to run static flow analysis to check all paths regarding whether a value will be null before dereferencing it, or not. Consider, for example, if there were unmanaged code invocations, multi-threading, or null assignment/­replacement based on runtime conditions. (Not to mention whether analysis would include checking of all library APIs that are invoked.)
  • There’s no reasonable syntax to indicate that a reference type value of null is invalid for a particular declaration.
  • There’s no way to decorate parameters to not allow null. 
دات نت پایه، سی شارپ 8.0 و Nullable Reference Types
اشتراک‌ها
Bosque زبان برنامه نویسی جدید مایکروسافت بر پایه تایپ اسکریپت

The Bosque programming language is designed for writing code that is simple, obvious, and easy to reason about for both humans and machines. The key design features of the language provide ways to avoidaccidental complexity in the development and coding process. The goal is improved developer productivity, increased software quality, and enabling a range of new compilers and developer tooling experiences. 

Bosque زبان برنامه نویسی جدید مایکروسافت بر پایه تایپ اسکریپت
اشتراک‌ها
FastEndpoints؛ جایگزینی دیگر برای Minimal APIs در دات نت 6

FastEndpoints offers a more elegant solution than the Minimal APIs and MVC Controllers with the goal of increasing developer productivity. Performance is on par with the Minimal APIs and is faster; uses less memory; and outperforms a MVC Controller by about 34k requests per second on a Ryzen 3700X desktop. 

FastEndpoints؛ جایگزینی دیگر برای Minimal APIs در دات نت 6
اشتراک‌ها
سری کتاب های You Don't Know JS

This is a series of books diving deep into the core mechanisms of the JavaScript language. The first edition of the series is now complete. 

سری کتاب های You Don't Know JS
اشتراک‌ها
روش نوشتن یک مقاله به کمک GitHub Copilot

In this post, I will be writing about how I used GitHub Copilot to write this post. You might be thinking that GitHub Copilot is a for writing code and you would right. However, it is a tool for writing content also. 

روش نوشتن یک مقاله به کمک GitHub Copilot
اشتراک‌ها
NET 7.0.201. منتشر شد

The .NET 7.0.201 release is available for download. This SDK includes the previously released .NET 7.0.3 Runtime and is in support of Visual Studio 17.5 release.  

NET 7.0.201. منتشر شد
نظرات مطالب
امن سازی برنامه‌های ASP.NET Core توسط IdentityServer 4x - قسمت ششم - کار با User Claims
همه نکات رو بررسی کردم. البته موضوع اینکه من اومدم IdentityServer رو در کنار Asp.net Identity استفاده کردم و دیتای user  رو از جدول مربوطه میخونم و عملیات لاگین رو هم به شکل زیر انجام دادم . 
  if (ModelState.IsValid)
        {
            // find user by username
            var user = await _signInManager.UserManager.FindByNameAsync(Input.Username);

            // validate username/password using ASP.NET Identity
            if (user != null && (await _signInManager.CheckPasswordSignInAsync(user, Input.Password, true)) == SignInResult.Success)
            {
                await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.UserName, clientId: context?.Client.ClientId));

                // only set explicit expiration here if user chooses "remember me". 
                // otherwise we rely upon expiration configured in cookie middleware.
                AuthenticationProperties props = null;
                if (LoginOptions.AllowRememberLogin && Input.RememberLogin)
                {
                    props = new AuthenticationProperties
                    {
                        IsPersistent = true,
                        ExpiresUtc = DateTimeOffset.UtcNow.Add(LoginOptions.RememberMeLoginDuration)
                    };
                };

                // issue authentication cookie with subject ID and username
                var isuser = new IdentityServerUser(user.Id)
                {
                    DisplayName = user.UserName
                };

                await HttpContext.SignInAsync(isuser, props);

                if (context != null)
                {
                    if (context.IsNativeClient())
                    {
                        // The client is native, so this change in how to
                        // return the response is for better UX for the end user.
                        return this.LoadingPage(Input.ReturnUrl);
                    }

                    // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null
                    return Redirect(Input.ReturnUrl);
                }

                // request for a local page
                if (Url.IsLocalUrl(Input.ReturnUrl))
                {
                    return Redirect(Input.ReturnUrl);
                }
                else if (string.IsNullOrEmpty(Input.ReturnUrl))
                {
                    return Redirect("~/");
                }
                else
                {
                    // user might have clicked on a malicious link - should be logged
                    throw new Exception("invalid return URL");
                }
            }

            await _events.RaiseAsync(new UserLoginFailureEvent(Input.Username, "invalid credentials", clientId: context?.Client.ClientId));
            ModelState.AddModelError(string.Empty, LoginOptions.InvalidCredentialsErrorMessage);
        }
ممکنه به خاطر این مورد باشه که sub رو تو claim ندارم.؟
مگر غیر اینکه با تعریف new IdentityResources.OpenId در IdentityResources و تنظیم AllowScope کلاینت به IdentityServerConstants.StandardScopes.OpenId خود IdentityServer الزاما SubjectId رو در claim به ما برگردونه؟