Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

Easy Configuration Binding in ASP.NET Core - revisited



In this post I'm taking another look at using strongly typed configuration settings in ASP.NET Core, using a slightly simpler approach that foregoes using IOptions in favor of directly using a configuration object instance. In the process I review the various approaches as a summary for getting configuration settings into .NET types.

Read more...

Working around the lack of dynamic DbProviderFactory loading in .NET Core



.NET Core and .NET Standard are missing the DbProviderFactories class which is used to dynamically load ADO.NET DbProviderFactory instances which in turn are used to gain access to the various ADO.NET intrinsic objects generically without requiring an explicit reference to the data access provider. In this post I describe why this can be a problem for libraries that use multiple data providers and show a workaround for loading a DbProviderFactory without taking an explict dependency on the provider assembly.

Read more...

Using Gists for General Purpose Web Pages with Markdown



Most of you probably know and use Github Gists for sharing Code snippets. But did you know that Gists also support Markdown? Using Markdown makes it easy to create much richer code shareable code and even allows for an easy way to create self-contained Web content.

Read more...

Dev Intersection 2017 Session Slides and Samples Posted



I've posted my Session Slides and code samples from last week's DevIntersection conference on GitHub.

Read more...

.NET Core 2.0 and ASP.NET Core 2.0 are Here



After a long wait .NET Core and ASP.NET Core 2.0 are finally here. This release is a major update from Version 1.0 that brings back a ton of functionality that was originally missing in .NET Core 1.x. With closer compatibility to full framework .NET it's much easier to port existing code to .NET Core, as having a much larger API surface to use in your applications. There are many usability improvements that make it easier to get started using considerable less fanfare. In this post I describe some of what's new and what's great and also a few things that are not so great.

Read more...

Opening a Web Browser with an HTTP Url from Visual Studio Code



Here's a quick tip on how you can create a project specific Visual Studio Task that can launch a Web Browser to a specific page quickly and easily.

Read more...

A few notes on creating Class Libraries for ASP.NET Core



I recently started to collect some of my ASP.NET Core utilities into a helper support library as I tend to do. In the process I ran into a few snags and I realized I was making a few non-obvious mistakes right from the start. In this post I discuss a few of the issues with dependencies and how to deal with them.

Read more...

WPF Slow Window Loading due to Invalid SpellChecking Dictionaries



I ran into a nasty problem with spell checking on WPF, which caused any form that uses spell checking to load extremely slow. It turns out the problem was caused by errant entries in the global Windows dictionary key in the registry. This post describes the problem and how to find and fix your global Windows dictionary settings.

Read more...

Conditional TargetFrameworks for Multi-Targeted .NET SDK Projects on Cross-Platform Builds



If you build multi-targeted .NET SDK projects on multiple platforms you're going to find out that certain targets can't be build on certain platforms. If you target NetStandard and Net45 on a Mac, Net45 is going to fail. In order to get around this you need to conditionally build per platform. Here's how.

Read more...

Accepting Raw Request Body Content in ASP.NET Core API Controllers



When posting raw body content to ASP.NET Core the process is not very self-explanatory. There's no easy way to simply retrieve raw data to a parameter in an API method, so a few extra steps are provided using either manual handling of the raw request stream, or by creating custom formatter that can handle common 'raw' content types in your APIs via standard Controller method parameters. In this post I look at various permutations and how you can access the raw data in your code.

Read more...

A Literal Markdown Control for ASP.NET WebForms



Spent some time last night creating a small ASP.NET Server control that can render literal Markdown text inside of ASPX pages and turn the literal text into Markdown. It's a very simple control, but it makes it lot easier to edit documents that contain simple formatted text content without having to deal with angle brackets for lengthier text.

Read more...

Configuring LetsEncrypt for ASP.NET Core and IIS



LetsEncrypt makes it easy to create SSL certificates for your applications for free and lets you automate the process. When using LetsEncrypt with IIS and ASP.NET Core however a few extra steps are required to make an ASP.NET Core site work with LetsEncrypt. I show you how in this post.

Read more...

Handling HTML5 Client Route Fallbacks in ASP.NET Core



HTML5 client routes work great on the client, but when deep linking into a site or pressing refresh in the browser, HTML5 client side routes have a nasty habit of turning into server HTTP requests. Requests to routes that the server is likely not configured for. In this post I look at why HTML5 client routes require server cooperation to handle and how to set them up on IIS and/or ASP.NET Core.

Read more...

Updating Windows Applications and Installers for non-Admin Installation



I recently updated Markdown Monster to run as a non-admin installation even when running the full installer. There have been many requests for this functionality and in this post I describe several of the updates required in order to make this work.

Read more...

JavaScript Debugging in a Web Browser Control with Visual Studio



Debugging a Web Browser Control embedded in a Windows application can be a bear because there's no obvious way to debug the the JavaScript code or HTML DOM/CSS inside of the application. Although the Web Browser uses the Internet Explorer Engine for HTML rendering and JavaScript execution and provides most of the engine features, the Debugger and F12 are not part of that. As it turns out you can use Visual Studio to hook up a script debugger and provide a rich debugging experience with the full IE debugger, Console and even a DOM/CSS Explorer. In this post I show how.

Read more...

Debouncing and Throttling Dispatcher Events



In UI applications it's not uncommon for a number of UI events to fire more events than your application can handle. In order to limit the number of events it's often a good idea to throttle or 'debounce' events so that only a single event is fire for a given period. In this post I describe a Dispatcher based implementation for debouncing and throttling UI events in WPF applications.

Read more...

Multi-Targeting and Porting a .NET Library to .NET Core 2.0



I've been holding off porting any of my full frameworks to .NET Core. With the latest .NET Core 2.0 and .NET Standard 2.0 releases and their vastly larger footprints that match more closely with what we expect of the .NET Framework feature set, migrating looks a lot more appealing. In this post I describe the process of porting one of my general purpose full framework libraries to .NET Standard 2.0 and in the process also creating a multi-targeted project that compiles .NET 4.5, 4.0 and .NET Standard projects.

Read more...

Bypassing IIS Error Messages in ASP.NET



IIS Error handling is the source of lots of confusion. I've been using IIS for nearly 20 years now, and figuring out the right combination of error configuration settings and code to properly serve custom error pages or error responses in API still makes fumble a few times before I get it just right. This post provides a few hints and some background on how to deal with error handling.

Read more...

Automating IIS Feature Installation with Powershell



IIS often gets a bad wrap for being diffcult to install and configure. However, using some of the built-in tooling for administration using PowerShell it's actually quite easy to configure IIS and even set up a new site and application pool with a few short scripts that are much quicker, and more repeatable than using the various Windows UI features. Here's how.

Read more...

Upgrading to .NET Core 2.0 Preview



With the release of the first preview of .NET Core 2 and ASP.NET Core 2.0 I decided to upgrade my AlbumViewer sample application to the latest bits and preview tools. Overall the experience was pretty smooth, but I ran into a couple of breaking changes and a few tooling snags that I'll describe in this post.

Read more...

IIS and ASP.NET Core Rewrite Rules for Static Files and Html 5 Routing



If you're running ASP.NET Core under Windows with IIS, you'll want to take advantage of letting IIS serve up your static content and handle your HTML 5 Client and home routes. IIS is very efficient at handling static content and content re-routing and in this post I describe how you can properly configure ASP.NET Core applications using the AspNetCoreModule and IIS Rewrite Rules

Read more...

Creating a Markdown Monster Addin: Save Images to Azure Blob Storage



The Markdown Monster Markdown Editor and Weblog Publishing tool has a .NET based addin model that makes it relatively easy to extend its core feature set with custom functionality. In this post I show how you can quickly create an addin of your own, and then show a practical example that demonstrates how add Image uploading to Azure Blob storage as an interactive addin.

Read more...

Running .NET Core Apps under Windows Subsystem for Linux (Bash for Windows)



The Windows Shell for Linux (WSL or Bash on Ubuntu on Windows) provides a nice way for Windows and Linux to interact without the overhead of dealing with a separate VM. Using the WSL you can now also run your .NET Core applications directly under Linux without requiring a VM or Docker. In this post I demonstrate how the shell works and how you can run your .NET and ASP.NET Core applications to test operation under Linux.

Read more...

Virus Scanning Madness for Software Distribution



I've been having having lots of problems recently with VirusTotal, which is used by Chocolatey to scan for malware in Chocolatey distribution packages. VirusTotal is a Web based service that aggregates around 60 virus scanners against an installation binary. The problems is that I frequently see random malware hits by various obscure scanners. In this post I describe the problem and the farce that this has become as some of the malware hits are obviously false positives that actually reverse in a rescan.

Read more...

Updating my AlbumViewer Sample to ASP.NET Core 1.1 and Angular 4



I updated my AlbumViewer sample application recently to the latest versions of ASP.NET Core (1.1) and the new .csproj project as well Angular 4

Read more...