Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

Recent Weblog Posts


Categories
ASP.NET (324) .NET (175) Windows (76) JavaScript (72) jQuery (61) Visual Studio (54) IIS (48) Csharp (47) WPF (47) HTML (46) AJAX (45) ASP.NET (33) Localization (32) LINQ (30) WCF (28) MVC (26) Personal (25) Security (23) HTML5 (23) FoxPro (22) CSS (21) Angular (20) C# (19) Web Services (19) Web Api (16) COM (16) ADO.NET (15) Vista (11) XML (11) Sql Server (10) HTTP (10) IIS7 (10) Markdown (9) WebView (9) Microsoft AJAX (8) IIS7 (7) West Wind Ajax Toolkit (7) Web Connection (7) Entity Framework (6) Internet Explorer (5) Html Help Builder (5) Markdown Monster (5) Mobile (5) Live Writer (5) ASPNET5 (5) C++ (5) OWIN (5) Web (5) SignalR (5) Software Development (5) NuGet (5) WinForms (5) Westwind.Globalization (4) Source Control (4) Silverlight (4) Cordova (4) Conferences (3) DataBinding (3) ASP.NET Core (3) LetsEncrypt (3) Help Builder (3) ISV (3) Networking (3) Office (3) Opinion (3) Razor (3) Web Browser Control (3) WebLog (3) Web Development (2) Visual Studio Code (2) RegEx (2) RSS (2) Speaking (2) Tools (2) Linux (2) Installation (2) Bugs (2) Help (2) Authentication (2) .NET Standard (2) Addins (2) Deployment (2) Dotnet (2) ASP.NET vNext (2) ADO.NET (1) Chocolatey (1) Control Development (1) Credit Card Processing (1) Cross-Platform (1) Dynamic Types (1) Email (1) CSharp Dotnet (1) Desktop (1) AI (1) Security (1) Visual Studio (1) Blazor (1) Blogging (1) ASP.NET Markdown (1) Angular JavaScript (1) FireFox (1) Flexbox (1) Git (1) Graphics (1) Hardware (1) IOS (1) JSON (1) Musings (1) Migration (1) Travel (1) Typescript (1) Testing (1) Threading (1) rxJs (1) SEO (1) RazorPages (1) VS Code (1) Web Assembly (1) Web Deployment Projects (1) Web Design (1) WebSockets (1) WebSurge (1) WebBrowser (1) WebDeploy (1) WFH (1) WPF Windows (1) WSL (1) wwHoverPanel (1) Windows-Terminal (1) Windsurfing (1)

Comparing Raw ASP.NET Request Throughput across Versions



When I set up a new machine I usually use a small ASP.NET test project to get a feel of performance of the machine and when that happens I also take a moment to compare performance across recent versions of .NET to see how things are improving - and improved they have. Both due to the new hardware I'm using but also ASP.NET continues to bump up performance in every new version that comes out. In this post I describe a simple project with minimal do nothing requests to test the ASP,.NET pipeline locally and how to test these request as well as discussing the results.

Reading Raw ASP.NET Request.Body Multiple Times



Some time ago I wrote about accessing raw request body content in ASP.NET Core which ended up being one of the most popular posts on this blog. But I failed to mention one major caveat: By default Request.Body can only be read once. In this post I discuss why frequently when you need raw Request.Body access you actually need to read the body more than once, and you can enable that functionality and deal with the caveats of doing so.

Sharing Tab Missing in Windows 11 Folder Properties



For some unfathomable reason, Windows 11 has removed the Sharing Tab on the Explorer Properties Context menu by default. The Sharing Tab allows you to shared folders and drives for remote access. In this post I discuss how to get the Sharing Tab back and also touch on how to make sure your machine can actually accept remote connections so you can share your folders and drives.

Working around the WPF ImageSource Blues



The WPF Image control and its ImageSource property can be problematic if you are loading a lot of images in a list. Depending on where you load images from, and how, you can very easily get bogged down with slow, blocking load operations, and memory leaks when the controls are released. In this post I describe a couple of specific problems I ran into loading a sizable list of images from files and show a few ways how to avoid the potential pitfalls related to ImageSource peculiarities.

Integrating OpenAI Image Generation into a .NET Application



Image Generation AIs are proving to be very good at creating images that can be used for all sorts of purposes. In this article I discuss how you can integrate image generation right into your own .NET applications using the OpenAI REST API. In addition I'll show how you can integrated this functionality into a larger application and discuss some general thoughts on image AI usage based on some of the experiences from a developer/non-designer user perspective.

Embedding a minimal ASP.NET Web Server into a Desktop Application



Did you ever need to embed a Web Server into a non-Web application? In this post I describe how you can use host ASP.NET in a non-Web application and specifically in a WPF desktop app. What do you need, how is it different and some of the issues that you need to consider if you want to use ASP.NET in your non-Web applications.

Save Files With Elevated Permissions on UnauthorizedAccessException



If you have an application that generically allows you to edit and save files, you might on rare occasions need to save files in locations that where a regular user account does not have permissions to save. Rather than failing wouldn't it be nice to let the user know and optionally allow saving with elevated permissions? In this post I describe the workflow and implementation on how to do just that.

Caching your WebView Environment to manage multiple WebView2 Controls



I've been struggling with rare WebView initialization errors in one of my applications, that have been difficult to debug and track down. After a lot of trial and error I discovered that the problem is related to WebView Environment instantiations that might be stepping on each other. In this post I describe the problem and a solution that involves creating a single WebView Environment and reusing it for all WebView initialization.

Rolling Forward to Major Versions in .NET



.NET Core has sophisticated policies that allows your applications that are compiled to specific versions of the .NET Runtime can roll forward to newer versions. You can specify what part of the version to roll forward and that generally works well, except for preview releases which require an extra step.

IIS Error 500.19 with ASP.NET Core Application



Running on IIS locally is pretty rare, but if for some odd reason you decide to run IIS locally on your dev machine you might find yourself getting a 500.19 error which relates to an issue in the web.config configuration. The solution is simple enough: Make sure the ASP.NET Core Hosting Module is installed. In this post I describe in more detail what the problem is and why you need a seemingly superfluous extra install to get IIS and ASP.NET Core to cooperate on local dev machine.

Dotnet Tool Component not found on the Mac



I've run into this problem a few times: I install a new Mac OS and then install the .NET SDK. A bit later I install a dotnet tool using `dotnet tool install -g` and then try to run it, only to find out that the SDK is not able find it. This post is a note to self on how to fix the pathing for .NET tools to be found correctly and to be able to run your dotnet tools.

Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET



ASP.NET Core doesn't have a Server.MapPath() method as classic ASP.NET had, and getting at the root path in Core is a little bit more involved than in those older versions. In this post I describe how to find the application Content and Web root folders and describe a MapPath() helper that simulates the old behavior.

A WPF Statusbar Control



Statusbar controls are boring, but because of the way that they are used there are a number of caveats like ensuring the UI updates even in linear code, allowing for timeouts of status messages and resetting to default, and to provide some visual clues to draw attention to the status messages displayed. In this post I talk about a custom status bar control and helper that make it super easy to use a new status bar control or attach additional functionality to an existing status bar.

Getting the .NET Desktop Runtime Installed with a Custom Runtime Checker and Installer



I've recently moved my Markdown Monster Desktop Application to .NET 7.0 and I had to make a decision on how to get the Runtime installed or packaged with my application. In this post I review the different deployment modes, the plus's and cons and the solution I ended up with which was to build a custom install wrapper that can check and install the runtime if not already present from an Installer or interactively.,

Getting .NET Library Projects to Output Dependent Assemblies



Recent .NET Core versions have changed how .NET Core Library projects output dependencies into the build folder. The new behavior doesn't output depdencies, unlike full framework .NET projects which always automatically dumped dependencies into the build output folder. This isn't a common requirement, but when you need it, the options are sufficiently obscure and this post discusses how you can make your dependencies output into the build folder

Implementing Two-Factor Auth using an Authenticator App in ASP.NET



Two factor authentication using Authenticator apps is getting more popular. One advantage of Authenticator 2FA is that you don't need to use a service nor do users have to provide additional bits of personal information. It's easy to implement, doesn't cost anything and also very secure as it uses one-time codes that can't easily be corrupted short of physical take over of a device. In this article I describe how Authenticator based 2FA works in the context of an application without using ASP.NET Identity.

Removing the IIS Server Request Header from ASP.NET Core Apps (any version)



ASP.NET Core applications that run on IIS as InProcess output an Server name for IIS into the HTTP headers. If you want to remove the server header, you'll find that the process for IIS is different than for the internally created Kestrel header and you can't use the same approach to remove the header as with Kestrel applications. In this post I discuss why the header behaves differently in IIS and how to remove it regardless of ASP.NET version.

Sending and Receiving GMail Email Attachments that contain Code or Binaries



As a developer, you're likely to occasionally send an email with attachments that are either code or binary executable files either as straight files or in a zipped up collection of code or binary files. You'll find that you can't actually send certain types of files or even files embedded in archives and even encrypted archives as most mail servers these days scan file content both before sending and when receiving email. In this post I discuss what works and what doesn't and how you can work around those files that don't work. It ain't pretty...

Setting an Absolute Output Path for .NET SDK Projects



By default .NET SDK project dump their final build output into a deeply nested folder structure that describes the build configuration, target, platform and sometimes additional package folders. While that's useful especially for multi-targeted projects. Sometimes you just want your output to go to specific folder without all that noise. In this short post I show you what you need to set in your project file to put your files exactly where you tell them to,

Preventing iOS Textbox Auto Zooming and ViewPort Sizing



If you've build mobile Web applications that need to run on iOS Safari and on an iPhone you might have run into the problem of input fields 'auto-zooming' the display when the input field and popup keyboard get focus. The view zooms and doesn't return back to the unzoomed even after exiting the input field. In this post I describe why this happens in some scenarios, and a couple of ways you can work around this annoying iOS Web browser behavior.

Using Application Insights in .NET Desktop Applications



Using Application Insights with desktop applications isn't the most obvious operation, as App Insights has been primarily designed as a tool for providing logging, statitics and exception report for Web based applications. However, with a little bit of reworking it's actually quite straight forward to use Application Insights with Desktop applications and in this post I show you how I integrate App Insights in my WPF applications.

WkHtmlToPdf: Dealing with broken Url Encoded and Extended Character Links



WkHtmlToPdf is a commonly used tool to create PDF documents from HTML files or Urls. Unfortunately it's a bit cranky and one of the problems you can run into is that links that include URL encoding won't work in your output PDF. In this post I describe the problem and a hacky workaround to make broken PDF links work by hacking the HTML file prior to conversion.

Async Event Methods and preventDefault() in JavaScript



When using async events, it's important to understand how events work when called asynchronously. Specifically if you need to interact with the event context for things like preventDefault(), cancelBubble() or returning values that determine completion state, you need to be careful as these may have no effect if called after an `await` call.

UpperCase Styling via CSS and text-transform



I learned something new today: there's a CSS `text-transform` style property that can be used to transform text automatically to upper, lower or capitalized case. No JavaScript contortions and it just works. In all my years doing Web dev I've not run into this property before, so I'm posting it here for others to find as well...

A Button Only Date Picker and JavaScript Date Control Binding



The native date picker in HTML is a bit of a pain to work with as it's overly simplistic in features and how you have to assign and retrieve values from it. It also isn't customizable so if you need to build custom behavior like a button date popup that doesn't show the input control, you're out of luck. In this post I discuss the challenges of the HTML date picker control, provide small component to make binding values easier, and provide an example on how to create a button only date picker both with plain JavaScript and as a small Vue component.

Basic Windows Machine Hardware information from WMI for Exception Logging from .NET



When writing out error information for a desktop application to a log whether local or to a telmetry engine, it's useful to get some idea of what hardware the app is running on. WPF applications in particular can have odd behaviors that are related to hardware acceleration, running inside of a VM or particular video drivers. In this short post I show how you can get very basic machine and GPU information that provides information on these basic system stats that can prove useful to trackdown rare hardware related issues.

Windows Audio Encoding Failure after Settings Change



Ran into a problem with Windows Audio not playing for MP3, WAV and other music files as well as some applications like Spotify. Any audio playback ended up resulting in an error related to an invalid encoder. Turns out the problem was an unexpected settings change. Here's the scoop.

HTML Table Cell Overflow Handling



HTML table column wrapping and truncating doesn't work like other HTML elements. Specifically if you want to keep table column content from wrapping via `overflow` or `white-space` wrapping settings you'll find that tables just laugh in your face. Here's a quick post that describes table wrapping and text truncation issues and the hacky workaround.

Fix that damn Git Unsafe Repository



As of Git 2.36.2 Git has a new security feature that won't allow running Git commands until the folder the repository lives in is 'trusted'. This can be annoying, but it's relatively easy to fix. In this post I look at what causes the issue and show a number of ways that you can use to trust the repository to get on with life...

SetResolution: Setting Windows Display Resolution from the Terminal



I recently switched to a single 4k monitor and had a need to quickly switch resolutions to avoid the UI hostile Windows Display Resolution widget in Settings. I ended up creating a small command line utility called SetResolution that lets you quickly and easily set a new Resolution, create profiles of resolutions to switch to.

Avoid WebDeploy Locking Errors to IIS with Shadow Copy for ASP.NET Core Apps



If you're self-hosting ASP.NET Core applications on IIS and using WebDeploy to publish to the server, you've very likely run into the dreaded locked file problem on the server. In this post I show you how you can work around locking problems with the base WebDeploy configuration and by using a new experimental feature in ASP.NET 6.0 to Shadow Copy deploy binaries. As a bonus this post also describes setting up and using Web Deploy in some detail.

HSTS: Fix automatic re-routing of http:// to https:// on localhost in Web Browsers



If you're doing local Web develop with multiple development tools you've probably run into a problem where you end up not being able to access a local site via unsecured `http://` requests and automatically get redirected to `https://` no matter what you try. If you don't have a certificate set up for the site you may not even be able to access the site at all. Turns out this usually is due to HSTS which is a nasty little bugger of a security protocol that is applied universally to a domain even in applications that don't use HSTS. In this post I discuss how HSTS works and why it can be a problem for local development as well as how to clear out the HSTS cache or avoid using it locally.

Testing HttpRequest.Form Variables in Unit Tests for ASP.NET Core Components



Here's a quick post that shows how to create a testable HttpRequest.Form collection so you can test form variables in a unit test.

Referencing a Local Private NuGet Package in your Solution



I recently needed to add a local reference to my project and I couldn't quite figure out the best way to do it in a transparent way to consumers of the repository, so that they wouldn't have to explicitly configure additional build settings in order to find dependencies. In this post I discuss how to add local references or use a local Nuget source to add non-public packages to your projects without explicit package feed configuration.

Keeping Content Out of the Publish Folder for WebDeploy



Sometimes when you publish a project to the server, you need to keep certain content that's part of your local development from publishing to the server. You can control how MSBuild publishing handles file output in a myriad of ways and it can be confusing if you don't know the exact settings you need to set for each scenario. In this post I discuss various options available include using the project item settings and the options in the pubxml file along with some commentary on when you might need this functionality.

Mapping Multiple Static File Folders in ASP.NET Core



Recently I needed to map an external folder as a 'virtual' directory in an ASP.NET Core application to include externally added content into the main Web application. ASP.NET Core's Static File Middleware provides easy mapping of a folder for static file serving, but it's not so obvious to add additional folders for static file serving. In this post I'll show you how to do this and a few other thoughts around this topic most common when physically hosting on a server.

ASP.NET Core MVC Views not Resolving Partial Views outside of the default ControllerContext



I recently ran into a problem with ASP.NET Core MVC views where rendering a Parent View in a Controller Context other than the originally designed context won't find Child Views that are referenced with no or local or relative paths. It turns out that ASP.NET Core MVC does not resolve local View paths as expected when rendering a View from a different ControllerContext instead using the current controller's context paths, rather than the view relative paths. In this post I describe why this can be a problem and several ways to work around this problem.

Fighting WebView2 Visibility on Initialization



The WebView2 control has a clever 'feature' that doesn't fully initialize the WebView control if it's not UI visible. While this can save resources in some scenarios it can also make for some very annoying behavior that causes startup timing and flickering issues. In this post I describe a few scenarios where this initial visibility delay loading can cause issues and show a trick you can use to get around it if this 'feature' causes a problem.

Back to Basics: Custom HTTP Response Header Manipulation in ASP.NET Core



HTTP Headers are a core part of the HTTP protocol and while applications rarely need to deal with them, when you need to set them - especially globally - ASP.NET Core doesn't have an obvious, built-in way to add headers to every request. In this back to basics post I describe what HTTP header, why you might set them and show how to set them as part of individual requests as well as globally for every request in your site.

Back to Basics: Rendering Razor Views to String in ASP.NET Core



Rendering a Razor View to string can be very useful to create string output from Views that you can capture and then use for things like Email confirmations or saved receipts that can be accessed 'offline' from the application. In this post I show you how to capture views to string and a few caveats you have to watch out for if you're generating self-contained HTML output to string.

Runtime C# Code Compilation Revisited for Roslyn



Recently I needed to update my scripting tools that are integrated into Markdown Monster, in order to support .NET Core. The old CodeDom compiler APIs I'd been using as part of my `Westwind.Scripting` library aren't supported in Core and so I ended up updating to the newer Roslyn CodeAnalysis APIs. In this post I discuss how the Roslyn compilation APIs work, and how I built and updated the Westwind.Scripting library to provide an easy to use wrapper around these tools.

Async and Async Void Event Handling in WPF



When running WPF and WinForms applications with async operations, I've run into a number of issues with event handling 'hanging' the UI thread in unexpected ways, where the UI hangs until the mouse is moved or a key is pressed. A lot of times these issues are associated with events that fire async code, and in this post I take closer look at one scenario that can cause these hang ups along with a workaround that has proven useful in a number of occasions for me.

Use CSS.escape() to escape QuerySelectorAll()



Ran into an issue recently where a querySelector operation was failing in document link navigation when navigating hashes. There are a few issues at work when using Hash navigation but one issue i didn't expect to run into was a naming conflict of a hash tag that interfered with CSS operators. Turns out there's an easy solution around with with CSS.escape - if you can make the connection. In this post I talk about the problem how it might show up and how to fix it.

Combining Bearer Token and Cookie Authentication in ASP.NET



In some situations you might need to use both Bearer Token and Cookie Authentication in a single application. In this post I look at a few scenarios where this is required and show how to configure your Authentication to let you access your site with either authentication scheme.

Creating a Static Web Content Project for Publishing with WebDeploy



Static content projects are more and more common and if you need to publish directly to an IIS Web Server using WebDeploy is one of the options you have. If you're building .NET projects there are many ways to publish projects from Visual Studio and the `dotnet` CLI. Unfortunately there currently is no .NET/Visual Studio project type that works out of the box for Static Site content - if you need to use WebDeploy. In this post I discuss how to hack a .NET Web project to work with static content only.

Escaping Markdown Code Snippets and Inline Code as Markdown



If you write Markdown for code related documentation it's not uncommon that you need to create code snippets or inline-code blocks that contain the Markdown code block delimiters namely the back tick. If you need to embed a Markdown code block as documentation in another code block or if an inline code block simply contains a ` you run into rendering problems. In this code I tackle escaping Markdown code for nested code blocks and escaping the pesky back tip character.

West Wind WebSurge 2.0 is here



I've just released West Wind WebSurge 2.0. WebSurge is a REST Client and Load Testing tool for Windows and in this post I provide a short overview, a link to a new YouTube Getting Started video, and some background on this release

Fixing Windows Control Focus on Toolbar and Menu Controls



You ever run into a problem in a Windows application where saving data off a Menu or Toolbar doesn't save the last changed value? Well, it's a pretty common problem in Windows Applications that's due to the fact that these controls don't change the active control focus which in turn can fail to update data binding from updating the underlying data source. In this post I go into detail on why this happens and describe a few workarounds.

Integrating Long Path Names in Windows Applications



Long Path Names in Windows are a pain in the butt, but Windows 10 recently starting adding better support for Long Paths in Version 1607+ which for now has to be enabled explicitly. It also requires an application configuration switch in the manifest file. As nice as that support is, it doesn't solve all problems especially when integrating with other components or external applications that don't support long paths. In this post I describe what works, what doesn't and a few hacks to make most things work.

Connection Failures with Microsoft.Data.SqlClient 4 and later



After a recent update to `Microsoft.Data.SqlClient` version `4.0.0.0` I ended up not being able to connect to any of my SQL Server databases. Turns out Microsoft has made some default settings changes in the updated provider and these settings are likely going to break connections.

Windows Authentication with HttpClient



In this short post I review how to use HttpClient with Windows Authentication security using Negotiate or NTLM authentication schemes, which oddly is not documented in the official documentation for the `CredentialCache` class used to handle authentication header generation in HttpClient.

Back to Basics: Add an ASP.NET Runtime Information Startup Banner



In almost every .NET Core Console application I end up adding a startup banner with some basic runtime information so I can see at a glance what environment I'm running in. I also add the URLs and any other application specific information that might be useful. In this short post I show a few things I display and how I reuse this functionality since it practically goes into every application I run.

Discovering new C# String Pattern Matching Features



I admit it: I haven't been using the new C# pattern matching features a lot, but every once in a while ReSharper smacks me in the head and points out a good pattern that not only makes the code more compact, but also makes it more readable. In this post I talk about a few patterns that help with null and string casting and with comparing values in a more natural way.

WebView2 Flashing when changing TabControl Tabs



I've been running into major issues with the WebView control and TabControls in WPF where switching between tabs that contain WebView controls causes a very annoying white flash. In this post I demonstrate the problem and provide an arcane fix that works around this frustrating issue.

Launching Visual Studio Code cleanly from a .NET Application



Visual Studio Code has become the mainstay editor for many developers. If you have developer focused applications and you need to externally display text or code content, it would be very useful to pop open VS Code to display external text/code content. This sounds simple enough, but Code both on Windows and Mac has some peculiar launch behaviors that make this a little more tricky than you might think, especially if you need to make sure that you can do it across platforms.

Using the WebView control to capture HTTP Request Content



Need to capture requests when navigating the new Edge WebView2 control? The control supports this but the way that you do this is a little less obvious than you might be used to from other browser controls. Here's how to do it.

WebView and Modal Dialogs in WPF Async Code



Another day another problem with the WebView control - this time dealing with certain Windows dialogs crashing the WebView control and making it unresponsive so that the control has to be reloaded or - more commonly the application has to be restarted.

Markdown Monster 2.0 is here



It's been a long slow road but Markdown Monster 2.0 is finally here. This update features a number of internal updates to facilitate future development improvements. In this post I go over some of the changes in the new release and some of the challenges that had to be worked through to get here.

Thoughts on Async/Await Conversion in a Desktop App



I spent the last month or so working through Markdown Monster's code to switch from mostly sync code to async code. This change was forced on me by an Async Cascade triggered by a third party dependency of a component (the WebView2 control) and ended up requiring massive changes throughout the app. In this post I go over some of the issues I ran into converting from sync to async along with some thoughts on the pitfalls.

Locked Files When Publishing .NET Core Apps to IIS with WebDeploy



When using Visual Studio's Publish Web Site feature with ASP.NET Core you may get frustrating errors when publishing to already running sites as files on the server are locked and can't be updated until the site is shutdown. Turns out the default settings don't unload the application before publising, but there's a simple solution to unload before publishing and the restart the application.

Running .NET Core Apps on a Framework other than Compiled Version?



I get asked frequently about whether a lower version of .NET Core will run on a machine that only has a more recent version of the .NET Core runtime installed. The short answer is 'No it won't run' but there are a few nuances to this simple answer.

WebView2 Home and End Key Problems inside of WPF TabControl Containers



Another day another WebView2 quirk to work around: This time running into issues with the WebView2 not processing Home and End keys properly as they are being hijacked by a parent TabControl and its TabNavigation keystroke handling.

Async/Await Calls Gotcha with the CSharp ? Null Propagator



Null propagation in C# allows for short circuiting of void method calls, but when using result-less `await` async calls, this behavior works decidedly different, resulting in null exception runtime errors. While this behavior makes sense when you break down the command, it's certainly not obvious. In this post I break down the how and why of the failure and how to work around it.

Taking down the Markdown Monster Source Code



With a heavy heart and a lot of hand wringing, I decided last week to take down the Markdown Monster source code from the public GitHub repository due to rampant abuse of the code to get around licensing restrictions. In this post I give some insight on why I made this decision and provide some general thoughts around the state of software development for software tools.

WebView2: Forwarding Alt Keys to a Host WPF Window



I've been puzzling over how to reliably integrate keyboard forwarding from the WebView2 control into WPF host forms. Unlike the IE WebBrowser control the WebView2 doesn't automatically forward Alt keys to the host form so special handling is required. In this post I describe why this is a problem and show the workaround to make this work.

LiveReloadServer - A Generic Local Static Web Server with Live Reload based on .NET



I've released v1.0 of my LiveReload Web Server which is a local static file Web server that includes support for LiveReload, plus some optional dynamic features for rendering self-contained RazorPages and Markdown content. This Dotnet Tool is fast, easy to use and includes a host of convenience features that try to make the process of working with local Web content quicker and easier.

Role based JWT Tokens in ASP.NET Core APIs



ASP.NET Core Authentication and Authorization continues to be the most filddly part of the ASP.NET Core eco system and today I ran into a problem to properly configure JWT Tokens with Roles. As I had a hard time finding the information I needed in one place and instead ended up with some outdated information, I'm writing up a post to hopefully put all the basic bits into this single post.

Opening an Admin Windows Terminal from Visual Studio



Opening Windows Terminal from another application is a bit of a pain. In particular I wanted to open Windows Terminal as an External Tool from Visual Studio and found it wasn't as easy as referencing the `wt.exe` executable. Opening as an Administrator adds additional complexity. In this post I'll talk about the use case of an External Tools and the settings to launch both a regular and admin Windows Terminal instance from External Tools.

Chromium WebView2 Control and .NET to JavaScript Interop - Part 2



In part 2 of this post series I take a look at how to use the new Chromium WebView2 to interact with the DOM document and interoperate between .NET and JavaScript, both calling into JavaScript from .NET, and calling into .NET from Javascript

Taking the new Chromium WebView2 Control for a Spin in .NET - Part 1



This is Part 1 of a two part article that gives an overview of the new WebView2 Web browser control that is based on Edge Chromium. In Part 1 I look at the basics of what's needed to run the control using the WebView runtime, and how to get the control embedded and configured to use for basic HTML tasks. In Part 2 I look at interaction between the .NET application and WebBrowser and Javascript.

Blank Zero Values in .NET Number Format Strings



Recently needed a way to display a set of numbers in a WPF List display that required that values with a value of `0` display blank - using no explicit code or model changes. I learnt something new today: There's actually a way to use C# format strings to format numbers separately for positive, negative and zero values. Here's how that works.

Watch out for .NET Core Runtime Bitness for IIS Installs



I recently ran into a snag with one of the my Windows Server installs of an upgraded .NET Core 5.0 application. It turns out I didn't install .NET Core 5.0 correctly because I made some bad assumptions of what I needed to install to run my application, even though it previously ran on .NET Core 3.1. Here's more detail on what the failure looks like and how to properly install .NET Core 5.0.

Upgrading several of my Applications and Libraries to .NET 5.0



Over the last week I spent some time upgrading several .NET Core Web applications and libraries from .NET Core 3.1 to .NET 5.0. I'm happy to say that this was always a non-event as the process went very smooth for once. In this post I'll talk about what I found and also offer some commentary why we should celebrate this update and push Microsoft to continue along this path.

PC and Mac with single Mouse and Keyboard Setup on Dual 4k Screens



A little while back I posted a couple of pictures of my new desk setup using both a Windows Laptop (a 2019 Dell XPS) and a Macbook Pro (2016) along with two 4k displays. I'm also using a single Logitech Mouse and Keyboard combination to control both machines and quite a few people were asking about how this works. So I decided to write a quick review of my setup here to give a few more details that are hard to give in a Twitter conversation.

Window Activation Headaches in WPF



Ran into a problem with properly activating a WPF when launching from Explorer and indirectly trying to activate an already running instance 'from within itself'. It seems simple, but windows focus-stealing restrictions can cause problems with actually getting focus into an application window. Here's how.
West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024