.NET Core 2.2 has been release for couple of weeks. However, the build pipeline is still failing these days. Microsoft has not installed .NET Core 2.2 SDK to the hosted VS2017 agents yet. Let's see how to work around this issue and have a success build for our .NET Core 2.2 apps. 1. Add Task Edit your build definition, and click the "+" button to add a new task. 2. Add .NET Core SDK Installer …
When we are dealing with URL encode in .NET Core 2.1, there are two APIs: System.Net.WebUtility.UrlEncode and System.Web.HttpUtility.UrlEncode. What's the difference between them? And which one should we prefer to use? I have done some research today, here's my findings. 1. Test Results First, let's see some tests. I've tested 2 couples of the same method between WebUtility class and HttpUtility …
In certain applications, we may need an on-screen ruler that indicates pixels on the screen. However, the only built-in ruler in UWP is within the InkToolbar control, we are not able to use it elsewhere. So, I will teach you how to build a pixel ruler which can be used anywhere in your UWP applications.
The Demo App
Create a new blank UWP application called PixelRulerUwp with minimal runtime …
More and more people are talking about .NET Core these days. It is true that .NET Core is the future, and .NET Framework will still be maintained because very large number of applications can’t be migrated in a short time.
.NET Core and .NET Framework are just like electric cars and gasoline powered cars. Gasoline cars is mature, and you can drive it without any problem, but electric cars have …
If you want to use captcha code to protect your website from spam messages, there are a few options such as Google ReCaptcha and captcha.com. Both of them can be integrated into ASP.NET Core applications. However, you may still want to generate the captcha code yourself for some reason, such as your website may be used in mainland China... This post will show you how to generate and use captcha …
Adding watermark to an image is very widely used in websites in order to protect the content owner's copyright, such as a blog system like this website. In traditional ASP.NET (.NET Framework), we could use System.Web.Helpers.WebImage to add text watermark like this: var image = new WebImage(imageBytes); image.AddTextWatermark( Settings.Instance.WatermarkText, "White", Settings.Instance. …
Microsoft released a new version of Windows 10 UWP SDK Build 17763, you can check the What's New document for more details. But when I retarget my App to version 17763, something unexpected happens, the AcrylicBrush gone missing if I change my App runtime to version 17763. I am not sure if this is by design on 17763 or it is a bug, I am trying to contact Microsoft product group on this problem. …
We can define versions on our .NET Core applications, but how to get the version at runtime? There are several ways to do it. First, let's see a typical .NET Core project file with versioning. We can define the version numbers for AssemblyVersion, FileVersion and Version in the project file (.csproj). The AssemblyVersion and FileVersion attributes must be in format of "major[.minor[.build[. …
In ASP.NET Core, if we use jQuery Ajax to post data to the server, and we want the ValidateAntiForgeryToken attribute to work. We have to do some tricks. The official document didn't document how to do it via jQuery. Let me show you how to do it. Please do read the official document first: https://docs.microsoft.com/en-us/aspnet/core/security/anti-request-forgery?view=aspnetcore-2.1 In my …
Introduction
As a website developer, we sometimes don't want the images on our own website to be directly referenced and showed on other's website. It can cause a lot network bandwidth for our datacenters in some cases, which means costing money for us to pay for the one who use our images.
For example, your website is A.com, you have an image on http://a.com/facepalm.jpg and B.com used your …