Teemablogi sissekanded

09.07.2019

Using Authorizing template of AuthorizeView in client-side Blazor applications

After blogging about authentication in server-side Blazor applications and discovering AuthorizationView component I was eager to find out how to use third authentication state Authorizing that is not available for server-side Blazor applications. This blog shows how AuthorizeView and Authorizing state work in client-side Blazor applications. NB! The code here is written for ASP. NET Core 3. 0 Preview 6. 02:12 09.07.2019 kanalilt DT blogi 2

17.06.2019

Authentication in server-side Blazor applications

Preview 6 version of ASP. NET Core 3. 0 is released and one interesting new feature is authentication and authorization for server-side Blazor applications. This blog post goes through work currently done and shows how authentication works with server-side Blazor applications. Creating server-side Blazor application When creating new server-side Blazor application there’s active change link in Authentication section. 08:40 17.06.2019 kanalilt DT blogi 2

06.06.2019

Authentication failed because the remote party has closed the transport stream

One beautiful day I found the following exception from application error logs: “Authentication failed because the remote party has closed the transport stream exception” and one of our integrations was down. The problem occured only in ASP. NET MVC application. Background services using same external service were not affected. Here’s the solution. We had to enable more security protocols in web application. 08:15 06.06.2019 kanalilt DT blogi 2

23.05.2019

HttpClient: How to remove charset from Content-Type header

I was writing client library for one online service and faced situation where I had to remove charset definition from Content-Type header. It was like content type is application/json or response is 415 “Unsupported media type”. I was using HttpClient class to communicate with service and without additional efforts charset doesn’t go away. Here is how I got charset definition away from Content-Type header. 05:30 23.05.2019 kanalilt DT blogi 2

22.05.2019

Building Blazor shared pager component

I have already implemented and then blogged about Blazor pager component and shared Blazor components. This post gathers my previous works and demonstrates how to build Blazor shared pager component we can use in multiple projects. Let’s start with shared Blazor component I introduced in my blog post Building Blazor shared components. For the end of this blog post I had clean out-of-box shared component with dummy content and no code. 06:58 22.05.2019 kanalilt DT blogi 2

21.05.2019

Speaking at .NET Summit Bucharest

This week I will speak at . NET Summit Bucharest. Event takes place on 24th of May at Radisson Blu Hotel. I will speak about Blazor, its internals and some interesting cloud scenarios. Here’s the brief overview of my presentation. My Blazor presentation My presentation is titled as “Building future web applications with Blazor” and it goes technically deeper than introductory presentations about Blazor. 12:43 21.05.2019 kanalilt DT blogi 2

Building Blazor shared components

Blazor has experimental support for shared components. Developers can build application-agnostic Blazor components and when packed to Blazor shared components library these components can be shared between Blazor applications. This blog post shows how to build shared Blazor components. Prerequisites This blog post was written when the following prerequisites were valid: . NET Core 3. 0 Preview 5 Blazor 3. 0. 10:22 21.05.2019 kanalilt DT blogi 2

20.05.2019

C# 8: Default implementations in interfaces

C# 8. 0 will introduce new language feature – default implementations of interface members. It means that we can define body to interface member and implementing class that doesn’t implement given interface member will use default one from interface itself. Here’s my deep-dive and analyzis to default implementions of interfaces. 14:00 20.05.2019 kanalilt DT blogi 2

16.05.2019

Tag helper syntax for view components

Calling view components in ASP. NET Core views may lead to long and ugly code lines containing generic type parameter of view component and anonymous type for InvokeAsync() method parameters. Something my readers have been interested in has been here for long time – tag helper syntax for view components. ASP. NET Core pager example Suppose you have pager implemented as view component and there’s support for multiple views. 06:15 16.05.2019 kanalilt DT blogi 2

14.05.2019

View component or tag helper?

Suppose you are working on ASP. NET Core web application. To avoid views and layouts grow massive you plan to separate some parts of these to independent components. This way you don’t repeat code you wrote once. You find view components and tag helpers. Which one to use? What’s the difference between view component and tag helper? It’s important to understand what is what before doing any work. 08:12 14.05.2019 kanalilt DT blogi 2

13.05.2019

gzip and cache control on Azure Blob Storage

Hosting WordPress site on Azure virtual machines means keeping away the loads we can serve from cheaper services. Same time we still want to keep site optimized so pages load fast. This blog post shows how to use gzip compression and cache control headers on Azure blob storage. I keep my blog content on Azure blob storage. Content is served to visitors using Azure Akamai CDN offering. 07:53 13.05.2019 kanalilt DT blogi 2

10.05.2019

Assembly version tag helper for ASP.NET Core

I’m writing some web applications where I must show assembly version in footer of all pages. Applications are published online through Azure DevOps release pipelines and I’m using automatic date based versioning for assemblies. Here is how to show application version using assembly version tag helper. I have multiple pages where version is displayed. Besides layout page there are also standalone pages like login page and error pages. 12:17 10.05.2019 kanalilt DT blogi 2

09.05.2019

Using query tags with Entity Framework Core 2.2

Entity Framework 2. 2 introduces query tags that make it easier to find specific queries from logs and output windows of Visual Studio. When running application on development box it’s possible to live without query tags. We can set breakpoints to see SQL generated from LINQ queries. 08:47 09.05.2019 kanalilt DT blogi 2

07.05.2019

Hosting WordPress on Azure

Another day, another disaster with shared hosting. And not this usual gateway-is-down-problem when people are visiting my blog. I started my journey with simple idea – why not WordPress on Azure? After some experiments I got my first results and the picture wasn’t as terrible pricewise as I thought. Here’s my first experiment with WordPress on Azure. 06:19 07.05.2019 kanalilt DT blogi 2

06.05.2019

Lightweight custom authentication with ASP. NET Core.

ASP. NET Core Identity is popular choice when web application needs authentication. It supports local accounts with username and password but also social ID-s like Facebook, Twitter, Microsoft Account etc. But what if ASP. NET Core Identity is too much for us and we need something smaller? What if requirements make it impossible to use it? Here’s my lightweight solution for custom authentication in ASP. NET Core. 09:09 06.05.2019 kanalilt DT blogi 2

23.04.2019

Serializing objects to URL encoded form data

While messing with dictionaries to create form data for FormUrlEncodedContent so I can send data to server using HTTP client, I started thinking about easier and cleaner way to do it. I was writing integration tests and I wanted to re-use some model classes instead of dictionaries. Here’s how to do it. Sample of integration test is incluced. Those who are currently writing integration tests for some ASP. 07:53 23.04.2019 kanalilt DT blogi 2

22.04.2019

Writing to CSV-file from multiple threads

I was writing document and metadata exporter that reads data from SharePoint and writes it to multiple files. I needed to boost up performance of my exporter and I went with multiple threads pumping out the data from SharePoint. One problem I faced – writing metadata to CSV-files from multiple threads in parallel. This blog post shows how to do it using concurrent queue. This posting uses CsvHelper library to write objects to CSV-files. 08:00 22.04.2019 kanalilt DT blogi 2

12.04.2019

File uploads in ASP.NET Core integration tests

Writing integration tests for ASP. NET Core controller actions used for file uploads is not a rare need. It is fully supported by ASP. NET Core integration tests system. This post shows how to write integration tests for single and multiple file uploads. Getting started Suppose we have controller action for file upload that supports multiple files. It uses complex composite command for image file analysis and saving. 08:00 12.04.2019 kanalilt DT blogi 2

11.04.2019

What’s new in next version of Microsoft Edge

Next version of Microsoft Edge browser is replacing its current rendering engine and in future it will run on Chromium – the same rendering engine used by Google Chrome browser. Edge gets total rework and ends one era in Microsoft history on browsers field. With new browser there will come interesting new features. Here is overview of insiders release of next Microsoft Edge. 13:36 11.04.2019 kanalilt DT blogi 2

09.04.2019

Using ASP. NET Core Identity user accounts in integration tests.

I have application that uses ASP. NET Core Identity with classic logins and there’s need to cover this application with integration tests. Some tests are for anonymous users and others for authenticated users. This blog post shows how to set selectively set authenticated ASP. NET Core Identity user for ASP. NET Core integration tests. Getting started We start with ASP. 06:40 09.04.2019 kanalilt DT blogi 2