ipz921

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

Mirror your iOS Device Screen on Windows with the free 5KPlayer


Apple doesn't exactly make it easy to use iOS devices on Windows and one complication is how you can cast your iOS device to a Windows screen. This is useful for presentations or screen captures that I often do and in the past i've gone through a number of shady tools that have come and gone. Recently ran into 5KPlayer which is a nice video player that as a bonus acts as an AirPlay server and makes short work of casting iOS content to Windows

ipz921Read more...

Using Angular's Live Reload Web Server to Refresh Pages on a Phone


Live Reload is now common for client side application development and it has become ubiquitous for Web development. But setting up Live Reload to work on a phone is not quite so obvious. In this post I'll walk you through what you need to do to get Live Reload to work on a mobile device for more productive on-device execution.

ipz921Read more...

Adding Additional Mime Mappings to the Static File Provider


If you're using the Static File Provider in ASP.NET Core you might need to add some additional extensions that are not handled by default. For example, if you host a Blazor site in your own application an additional mime mapping for `.dll` is required. Here how you can map extra extensions to the Static File middleware.

Read more...

ASP.NET Core WebSockets and Application Lifetime Shutdown Events


WebSockets in ASP.NET Core are easy to use but due to the simple model it's easy to forget that socket requests are long lived and can linger for a long time in the background and that can cause problems when an application needs to shut down cleanly. Luckily there's an `IHostApplicationLifetime` interface available that allows hooking shutdown operations and that provides the necessary cancellation tokens to allow an WebSocket connection to be terminated in response to a shutdown event. This post shows how this works.

Read more...

Fixing Adsense Injecting 'height: auto !important' into scrolled Containers


Ran into a weird issue today with AdSense in one of my older Web sites. I noticed that the site was not using the custom scrolling in containers that I've been using for years. Turns out Google's AdSense on this page is injecting some extra styling that changes the scroll behavior - and the way the entire page works. Here's what the problem is and how you can work around it.

Read more...

Using WSL to Launch Several Bash Command from an Application


Struggled today with launching WSL from a Windows application to automate an external build process. Turns out this was a lot harder than it should have been due to some quirks on how the `wsl.exe` and `bash.exe` are registered by the Windows Sub System for Linux.

Read more...

Static Constructor Failures and Declaration Order


I ran into an ugly problem today with an application where nested static constructors where not doing the expected thing - failing to provide a value when one should be available. It turns out the issue has to do with constructor calls nesting and the order in which auto-initialized values are assigned.

Read more...

Missing Sharing Tab in Windows Explorer and Sharing with PowerShell


On several of my machines I've found that the 'Sharing Tab' in Explore had gone missing and I've been unable to create a share through the Windows UI. Apparently some update or software installed mucked with my settings that created an explicit exclusion to disable this Shell Addin. In this post I describe how to fix this problem and then offer several solutions: Fixing the UI problem and maybe more usefully show how you can use Powershell to share a folder or drive instead of the Windows UI.

Read more...

Displaying Nested Child Objects in the Windows Forms Designer Property Grid


The Windows Forms designer sometimes feels very dumb - one of those times is when dealing with nested properties on a control which by default is not displayed as an expandable property that you can just dig into. Instead you have to do a bit of busy work using a TypeConverter to make it possible to create an expandable property in the designer. Here's how.

Read more...

Content Injection with Response Rewriting in ASP.NET Core 3.x


If you're creating middleware components you might need at some point to inject content in the existing HTTP output stream in ASP.NET Core. In this post I discuss how to intercept Response output by using a customized stream, modify the data and update the final output generated, effectively providing response filtering.

Read more...

Back to Basics: Rewriting a URL in ASP.NET Core


Sometimes in an application you need to take over the routing process with some custom processing that acts on an incoming URL and actually has to go to another URL. This can be a simple relinking task from old content to new, or it can be more complex where you access a specific URL on the public site that actually needs to be processed by another URL altogether.

Read more...

Troubleshooting Windows Sleep Insomnia


Windows long has had problems making machines stay in Sleep mode. In this post I describe some of the problems and likely solution by using `powercfg.exe` to hunt down and disable devices that can wake the computer from sleep.

Read more...

Working with IWebHostEnvironment and IHostingEnvironment in dual targeted ASP.NET Core Projects


In ASP.NET Core 3.x Microsoft introduced a new `IWebHostEnvironment` to replace the obsoleted `IHostingEnvironment`. While that works for top level applications this can cause some complications for multi-targeted libraries that need to support both .NET Core 2.x and 3.x. This post describes the problems and offers a few workarounds.

Read more...

Null API Responses and HTTP 204 Results in ASP.NET Core


ASP.NET Core's default API handlers return an HTTP 204 response for null value results. This is meant to be a convenience feature, but if your calling API depends on a proper JSON response or an HTTP 200 result code, it can cause applications to break. In this post I'll describe why this can be a problem and how you can return proper JSON results for null values.

Read more...

Deleting Problem Folders and Files on Windows: Could not find this Item Error


Ever have a problem not being able to delete a file or folder because the filename is invalid? You see it in Explorer, but you can't delete or move the file? Well I just ran into this issue and after some digging figured out that you use extended path syntax `\\?\` to get around some interesting naming and sizing issue with Windows path operations.

Read more...

ASP.NET Core IIS InProcess Hosting Issue in .NET Core 3.1


Ran into a nasty little issue with a hosted ASP.NET Core 3.1 application where InProcess hosting was not working. It turns out I hit a regression bug in 3.1 that causes InProcess hosting to fail if there are certain dependencies.

Read more...

A HighlightJs Copy Code Badge Component


In this post I describe a small, very specialized addon component for the HighlightJs Syntax highlighter that displays a badge that lets you copy the code snippet and displays the syntax language. The post covers how to use this simple component,and a look behind the scenes on how it works.

Read more...

VSIX Installer Extension Manifest and Visual Studio Version Numbers


Ran into a problem with updating a Visual Studio extension today where the VSIX installer first failed to install for the latest version of Visual Studio and then failed to enable the option to install for that same version. Turns out it was related to incorrectly specifying the right version number for VS 2019 and in this post I show how to use the correct (and somewhat unexpected) version syntax.

Read more...

Creating Angular Synchronous and Asynchronous Validators for Template Validation


Validations are a key feature of any business application and in Angular there's an infrastructure for building validators built in. A number of existing validators provide the basics but if you have custom business logic to process for validation you'll need to create custom Validators. In this post I describe how to create both sync and asycn Angular Validators for use in declarative forms.

Read more...

FireFox, Windows Security and Kestrel on ASP.NET Core


Ran into issues today with Windows Authentication and FireFox in a ASP.NET Core application where auth was working with all browsers **except** for FireFox. Firefox would just throw up endless sequences of login dialogs or in some cases just show the default ASP.NET Core 'UnAuthenticated' dialog. Here's what this looks like and how to work around it.

Read more...

Dynamically Loading Assemblies at Runtime in RazorPages


I've been working on some tools that create generic, standalone Web servers using ASP.NET Core, in various configurations. One of the versions I'm building also supports Razor Pages and while genericallly hosting Razor Pages out of a locally run folder, there are some complications that arise out of dynamic runtime compilation. In this post I look at how to dynamically load assemblies at runtime.

Read more...

Windows Authentication and Account Caching on Web Browser Auto-Logins


If you're working with Windows authentication to access Windows or Active Directory groups be aware that there's a gotcha with newly added groups when users are automatically logged into the Web browser.

Read more...

Serving ASP.NET Core Web Content from External Folders


ASP.NET Core makes it easy to create a new Web site, but by default the location of where the application runs and serves files from is pretty static and pinned to the startup folder of the application. In this post I discuss another usage scneario of building a generic local Web Server that can start serving files out of **any** folder.

Read more...

Upgrading my AlbumViewer Sample Application to ASP.NET Core 3.0


.NET Core 3.0 is here and in this post I describe the process of updating an existing ASP.NET Core Angular API application to this latest release. For the most part the update process is very smooth with a few configuration changes required, but there are also a few gotchas that have bitten me and I'll cover those here.

Read more...

Open Internet Settings Dialog directly on Windows


Windows is making it harder to find classic Control Panel windows and the Internet Settings dialog is no exception. The Networking options no longer have a link to it, so you have remember where to look for it. Here's a quick way to get to it.

Read more...