X

ASP.NET

Authentication in server-side Blazor applications

Preview 6 version of .NET Core 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.

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.

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.

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?

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.

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.

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.

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.

Using custom startup class with ASP.NET Core integration tests

My previous post demonstrated how to use custom appsettings.js file with integration tests in ASP.NET Core. But in practice it’s not enough and very often we need custom startup class that extends the one in web application project to configure application for integration tests. This blog post shows how to do it.

Using custom appsettings.json with ASP.NET Core integration tests

ASP.NET Core introduced the concept of TestServer for integration testing of web applications. Integration tests need web application run with all bells and whistles to make sure that all components work together with no flaws. Often we need special settings for integration tests as web application cannot use live services and easiest way to do it is to use special appsettings.json file. This blog post shows how to do it.