Thomas Ardal

Thomas Ardal

Meet Thomas, the founder and developer behind elmah.io. Thomas blogs about everything technical from C# and ASP.NET Core to machine learning.

Denmark
320 posts
Access ASP.NET Core website hosted on IIS Express from a phone

Shows how to test a locally hosted ASP.NET Core site running on IIS Express from a real phone using Ionut-Cristian Florescu's iisexpress-proxy npm tool (e.g. npx iisexpress-proxy 44302 to 80), skipping app.UseHttpsRedirection() outside IsDevelopment, and finding your LAN IP with ipconfig findstr. ...

Cookie authentication with social providers in ASP.NET Core

Walks through replacing ASP.NET Core Identity with manual cookie authentication in Startup.cs, configuring AddAuthentication and AddCookie, wiring up UseAuthentication/UseAuthorization, and building a login form that signs in via a ClaimsPrincipal. ...

Introducing Heartbeats

Announces elmah.io Heartbeats and shows the ASP.NET Core integration: installing Elmah.Io.AspNetCore.HealthChecks, calling AddElmahIoPublisher with an ApiKey, LogId, and HeartbeatId, then scheduling hourly health checks via HealthCheckPublisherOptions. ...

Export data to Excel with ASP.NET Core

Demonstrates two ways to export data to Excel from an ASP.NET Core controller: generating a CSV file manually with StringBuilder and the File helper, and creating a real XLSX spreadsheet with the ClosedXML NuGet package's XLWorkbook and Worksheet APIs, compared briefly to EPPlus and OpenXml. ...

Extending the date for removing the v2 API

Announces that elmah.io's legacy v2 API, used by all Elmah.Io.* client packages versioned 2.x and deprecated three years earlier for lacking API key security, will be shut down on June 1, 2020, and explains how to disable v2 access from the Actions tab of your log settings before then. ...

NLog Tutorial - The essential guide for logging from C#

Covers NLog end to end for C#: the six log levels (Fatal down to Trace), getting a Logger via LogManager.GetCurrentClassLogger(), the fluent logging API, structured logging with Properties, and configuring targets - NLog ships with almost 100, from the console and SQL Server to elmah.io. ...

Cross-site request forgery (CSRF) with ASP.NET Core and AJAX

Shows how to wire up CSRF protection for AJAX calls in ASP.NET Core: registering AutoValidateAntiforgeryTokenAttribute as a global MVC filter, rendering a token with @Html.AntiForgeryToken(), and forwarding it as a RequestVerificationToken header on every jQuery POST, PUT, and DELETE via ajaxSend. ...

Upload and resize an image with ASP.NET Core and ImageSharp

Replaces ASP.NET's discontinued WebImage class with the SixLabors.ImageSharp NuGet package in ASP.NET Core: accepting an upload via IFormFile, loading it with Image.Load(file.OpenReadStream()), resizing to a fixed 256x256 with image.Mutate(x => x.Resize(256, 256)), then saving the result. ...

The ASP.NET Core security headers guide

Updates a classic ASP.NET MVC security-headers guide for ASP.NET Core: setting headers via middleware (app.Use) or a web.config customHeaders block on IIS, covering X-Frame-Options (DENY vs SAMEORIGIN), AddAntiforgery's SuppressXFrameOptionsHeader, and the deprecated X-Xss-Protection header. ...