Fixes the 404 on blazor.webassembly.js when a Blazor WASM SPA is published to a subdirectory like GitHub Pages, replacing the static base href tag with a JavaScript snippet that dynamically sets the base path from window.location.pathname, working on localhost and nested routes alike. ...
Explains setting a User-Agent header on HttpClient in .NET/C# with ProductInfoHeaderValue, covering per-request headers via HttpRequestMessage, default headers via DefaultRequestHeaders, and HttpClientFactory, plus the bot format .NET/5.0 ScraperBot/1.0 (+http://example.com/bot.html). ...
Extends a Blazor WASM wrapper for the Popper.js library to invoke C# callbacks like onFirstUpdate from JavaScript, using JSInvokable methods on an Options class and a DotNetObjectReference passed into IJSRuntime.InvokeVoidAsync, with IDisposable cleanup on the Popper class to avoid memory leaks. ...
Implements web push notifications in ASP.NET Core using the VAPID standard, covering building a minimal PWA with a manifest.json and ServiceWorker.js, generating a VAPID public/private key pair stored in appsettings.json, and subscribing the browser to the push service to send native notifications. ...
Shows how to wrap the Popper.js positioning library in a .NET Core 3.1.300+ Blazor WebAssembly project, creating a C# Popper class that injects IJSRuntime and calls InvokeVoidAsync against a PopperWrapper.js helper file, mapping ElementReference parameters through to Popper.createPopper. ...
Implements the OAuth 2.0 Authorization Code flow with JSON Web Tokens directly in ASP.NET Core, skipping IdentityServer4, OpenIddict, and ASOS, with a walkthrough of an Authorize-protected action validating response_type, client_id, and client_secret before issuing a code exchanged for a JWT. ...
Compares Stripe two payment options for SCA-compliant recurring billing in ASP.NET Core after Europe September 2019 SCA mandate: redirect-based Checkout versus embeddable Stripe.js, settling on Stripe.js so one form offers Monthly and Yearly subscription plans via radio buttons. ...
Diagnoses three SqlClient.SqlException messages in Entity Framework and SQL Server: Login failed for user, fixed via Integrated Security and auth-mode checks; Cannot open database, fixed via myContext.Database.EnsureCreated(); and network/instance-not-found errors tied to SSMS remote settings. ...
Shows how to convert uploaded PNG/JPEG images to Google WebP format (up to 34% smaller) in ASP.NET Core MVC using the ImageProcessor and ImageProcessor.Plugins.WebP NuGet packages, validating IFormFile uploads by content type, and using the HTML5 Picture tag as a fallback for Safari. ...