Contact   •   Articles   •   Products   •   Search

Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs

Recent Weblog Posts


The Rise of JavaScript Frameworks - Part 1: Today



JavaScript frameworks have moved front and center in the mainstream in the last year and a half or so. When building modern Web applications, the bar has been raised significantly by what is possible in large part due to the more accessible mainstream frameworks that are available today to build rich client and mobile Web applications. In this post I'll explore why JavaScript frameworks have become so popular so quickly and how it effects the future of Web development. This two part series addresses the current state in this post, and the new crop of V2 frameworks arriving later this year in the Part 2.

Multiple Desktops in Windows



Windows 10 natively supports multiple desktops which provides great opportunity for reducing clutter while working and getting stuff done. In this post I show how the new Windows 10 multi-desktop features work and also show how you can use multiple desktops in previous versions of Windows.

Windows 10 Upgrade and IIS 503 Errors



After upgrading my machine to Windows 10 today I found that IIS, while working was throwing 503 Service Unavailable errors on every page. Turns out the issue is the Rewrite Module wasn't updated in the upgrade and that's causing a hard crash of the IIS module. Here's how to fix this issue.

External Links in Cordova for iOS



When building Cordova apps for iOS you need to be prepared to deal with external links that you might want to open outside of the WebView control. By default any 'external' links routed to an href target or window.open() call are still opened in the same WebView rather than externally in Safari or whatever the default browser is. This often is a problem since there's no way to navigate back to your initial content. In this post I describe the problem and how to use a plug-in to work around what should be native behavior in any WebView control.

Rebooting Database Localization for ASP.NET with West Wind Globalization 2.0



I'm happy to announce the release of Westwind.Globalization version 2.0 - a database resource localization library for ASP.NET. Version 2 is a major upgrade that includes many new features including support for new database providers, a brand new Web Resource Editor, much improved ASP.NET MVC support, vastly better support for importing and exporting Resx resources, creating of strongly typed classes and much more. There's also a new video that describes features and provides a getting started guide with some detailed background. In this post I review some of the new features and point at additional resources for more information.

Turn off HTML Input Auto Fixups for Mobile Devices



You ever run into a Web site that messes with your user input when you don't want it to while using your phone? You know, capitalize the first letter when you're trying to enter a username, or email address, or auto-correct text while typing a part number. As a mobile Web developer it's easy to forget about these automatic behaviors, when you don't want them as auto correction and fixup is the default behavior. To provide the best user experience sometimes we need to be agressive about turning enhancement functionality off. In this post I talk about auto-fixup behaviors for mobile browsers and how to turn them off in your applications. Your users will thank you for paying attention to this small detail.

Using and Debugging External Source Code Packages in ASP.NET 5



ASP.NET 5 and the new DNX runtime make it very easy to include external source code based packages into your own projects. It super easy to pull a project - including Microsoft's core DNX runtime projects, from GitHub and then link it into your own projects. This is great for debugging and fixing an immediate problem that might be a show stopper for you, or makes it very easy to contribute back to an open source library. In this post I'll describe a debug scenario I ran into in my last post involving a bug in the DNX runtimes, and show how to download and link the library from Microsoft's GitHub repository, fix the bug and integrate the code into my own project.

IPad Scroll Issues with Fixed Content



Ran into some issues with fixed headers again in one of my mobile applications where on an iPad it appeared the content wouldn't scroll properly. I've run into this issue a few times and it turns out it's related to positional layout and specifically problematic on iPad Safari browsers. In this post I'll discuss the problem and the relatively simple workarounds.

Strongly typed AppSettings Configuration in ASP.NET 5



ASP.NET 5 features a new configuration system that includes a number of new configuration sources as well as an easy way to consume strongly typed resources. In this post I demonstrate how to use the basic features and show how you can use different configuration stores to hold configuration data.

How to manage Content in NuGet Packages?



In getting ready to put out version 2 of Westwind.Globalization I've been rearranging the NuGet package layout a few times and I'm considering further breaking out the package layout. In this post I describe some of the dilemmas I'm looking at in deciding how much abstraction is required in breaking the NuGet packages into easily usable and maintainable components with the least amount of friction.

Interactive ASP.NET Resource Linking and Editing with Westwind.Globalization



Resource linking for resource editing is a very useful feature when localizing application, making it easy to jump back and forth between content and the resources that need to be edited. Seeing resource content in context is vital to good application localization. Westwind.Globalization provides a simple HTML based resource linking mechanism and in this post I describe how it works, and how it's implemented in the Westwind.Globalization library.

Right To Left (RTL) Text Display in Angular and ASP.NET



Recently I was gently asked to add support for RTL language editing in my Westwind.Globalization library and the Web Resource Editor. The Editor supports displaying resources in all of its localized version, but it didn't respect the RTL setting for languages that required it. In this post I describe how RTL support works in browsers, how you can detect RTL support on a locale in .NET and demonstrate how I integrated basic RTL edit and display support for the Resource Editor using a custom Angular directive.

Angular Select List Value not binding with Static Values



Ran into a problem converting from Angular 1.3 to 1.4rc a couple of days ago. The issue is that the way ng-model bindings work has changed, in that Angular 1.4 and later uses exact type matching for value comparisons which results in behavior changes. In my case I ran into a problem with static list values binding to a non-string value which caused the binding to effectively not work at all. Here's what the problem is and how to work around it.

401 Response from ASP.NET Identity when linking to External Accounts



A couple of days ago I ran into an odd problem where all of my external ASP.NET Identity providers would fail to redirect to the external provider login URLs. Instead the app fired empty 401 requests without any other indication of failure. It turns out this was a misconfiguration issue, but it took a bit to track this down due to the fact that there's no error trapping and no error information. Here's more info on this edge case failure.

Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application



ASP.NET 4 provides a new Identity Authentication/Authorization framework that's very comprehensive and works reasonably well for new applications. However, if you have existing applications or use custom user management, it's not very clear how to use just the basic OWIN Authentication/Authorization layer without the full UserManager and Entity Framework implementation. In this post I describe how to use the bare minimum Identity features to hook up a custom domain model for both local and external logins in an ASP.NET MVC application.

ASP.NET MVC HttpVerbs.Delete/Put Routes not firing



If you're using ASP.NET MVC to build API endpoints in your application you might have run into a problem where the PUT and DELETE HTTP operations don't work - you get a 404 instead. Turns out that the IIS default configuration doesn't include the verbs for a required handler. Here's what the problem is, and how to fix it if it hits you.

Adding Files to the Windows MRU/Recent Document List



In this post I talk about adding shortcut files to the Windows Most Recently Used (MRU) list that is also used for task bar icon Jump Lists. There are easy APIs that let you add associated files to your application's MRU. With a little extra work you can also read this list inside of your own applications so you can build your application specific MRU lists and let Windows manage the storage of the linked references rather than your own configuration. Here's how.

Prettifying a JSON String in .NET



Occasionally it's useful to prettify an existing JSON string that you've received from somewhere: An HTTP response you need to look at while debugging or a UI that needs to display JSON to the user. Here's a small tip that makes it easy to take a JSON string and prettify it using the JSON.NET library.

Bitmap types, Binary Resources and Westwind.Globalization



I've been working on supporting binary resource imports via the Web interface using Westwind.Globalization and I'm debating on whether supporting the .NET convention of importing image resources as Bitmaps is prudent. Bitmaps are rather unwieldy to use and are painful to export to common stream or file formats due to the funky 30 year old encoding architecture used by GDI+. In this post I talk about some of the issues I've run into with Bitmaps and why I'm considering importing resources simple as raw byte data.

Updated DeleteFiles Utility now on Chocolatey



I've updated my DeleteFiles utility that can be used to recursively delete files and folders. I've recently updated the utility with a few new features including support for long paths (greater than MAX_PATH) that can choke out Explorer and other Windows shells. There are also additional options for previewing and recycle bin support as well quiet command line mode and a few improvements in the timeout filter for file selection. Last but not least, you can now install DeleteFiles directly from Chocolatey so it's easy to load DeleteFiles and get it onto your system and system path in seconds.

ASP.NET MVC, Localization and Westwind.Globalization for Db Resources



Recently I've been getting a number of questions related to customers having issues with running the Westwind.Globalization Database Resource provider library under ASP.NET MVC. While the original versions of this library were definitely WebForms centric since it originated in the WebForms era, the library has had full support for ASP.NET MVC for a while. In this post I'll review how localization works in ASP.NET MVC and then demonstrate how Westwind.Globalization handles the same scenarios with database resources.

Cordova and Visual Studio CODE Magazine Article



Looks like my "Taming Mobile Apps with Cordova and Visual Studio" article went live recently. If you want to find out how to use the new and pretty awesome Visual Studio Tools for Apache Cordova for building Web based, hybrid Mobile apps, this article is a great starting point. The article gives an overview of Cordova and then walks through examples with special focus on building iOS apps.

Using FontAwesome Fonts for HTML Radio Buttons and Checkboxes



Spruce up your boring checkboxes and radio buttons with custom FontAwesome symbols using a little bit of CSS. If you're tired of boring checkboxes and radio buttons, or you simply want a more consistent look of these controls across browsers and controls check out FontAwesome to provide you with customizable checks and boxes to use for selection boxes. In this post I'll show how to use pure CSS to set up FontAwesome checkboxes and radios and talk about a few gotchas I ran into along the way.

Back to Basics: UTC and TimeZones in .NET Web Apps



Storing dates in persistent storage using UTC dates is a widely accepted best practice. But it's surprisingly complex using date data effectively if you want to let the user see dates and query data in their local time zone. Looking around I noticed that there's not a lot of comprehensive info on this topic, so I decided to take notes and write down some of the approaches I've used in this post. This post combines and overview and a number of helper routines specifically geared towards user timezone adjustments in typical ASP.NET Web applications.

Adding non-NuGet references to the new vNext Projects



vNext projects depend on NuGet packages to reference external dependencies. But vNext projects also support 'classic' .NET targets and the Full CLR vNext both of which support and even require assembly references in order to access core .NET functionality. In this short post I describe how you can reference external assemblies in non-vNext and FullClr vNext targets in vNext projects.

Azure VM Blues: Fighting a losing Performance Battle



I've been struggling with performance when putting up an Azure virtual machine with the eventual intend to replace my physical server. In this post I describe some of the performance issues I've run into with Azure Virtual Machines in a simple scenario of migrating a single Web site to a full VM setup.

Blend Path interfering with C# Project Builds



Ran into a nasty Visual Studio error today that caused a compiler error related to an errand assembly reference from Visual Studio Blend. Blend? I don't even use Blend, and this is a Web Project. Here's what the problem is and how to get around it with a temporary hack.

<main> HTML5 Tag not working in Internet Explorer 9/10/11



Ran into a problem the other day with Internet Explorer 11 not rendering the HTML5
tag properly - or rather rendering as if it wasn't there at all. Here's the problem and the simple workaround.

Tip: Create a Visual Studio Menu option to Open a Command Window



I'm finding myself using the command line more and more, especially with ASP.NET vNext for running Web apps from the command line, accessing git and JavaScript build tools. Here's a real easy way to pop open a Command Window in the active project directory from Visual Studio.

Using Cordova and Visual Studio to build iOS Mobile Apps



Apache Cordova is a hybrid mobile toolset to build Mobile applications using Web Technologies like HTML5, CSS and JavaScript. Microsoft recently released a preview of its toolset for building Cordova applications with Visual Studio. In this article Rick takes a look at the Visual Studio Tools for Apache Cordova for building, debugging and running iOS mobile applications from Windows by way of an example that takes an existing mobile Web AlbumViewer app and porting it to Cordova.

INSTALL_FAILED_VERSION_DOWNGRADE: Watch your Android App Version



Ran into a nasty problem with an Android app install today and was unable to get the app to install on the device for debugging. Got an INSTALL_FAILED_VERSION_DOWNGRADE after a bunch of false starts it turns out this problem had an easy solution for me.

Gotcha: Entity Framework gets slow in long Iteration Loops



I've been running into a common issue with Entity Framework where using a dbContext through many context operations can drastically slow down Entity Framework performance. Here's a quick overview of the problem and how to work around it with a few minor tweaks.

Mixing $http Promises and $q Promises for cached Data



When creating services it's often useful to return data from the $http service, or cached data that already exists. You can't however just return the cached data, but have to turn it into a promise so it matches the $http callback signature. Here's how to deal with this frequent scenario.

Creating multi-target NuGet Packages with vNext



The ASP.NET vNext Platform makes it much easier to create multi-targeted NuGet packages, through support of multiple build targets from a single project and the ability to compile project output directly to a NuGet package.

Updating Assembly Redirects with NuGet



There's little known NuGet command that allows you to re-create assembly redirects for all NuGet packages in your project or an entire solution.

WebClient and GetWebResponse not firing on Async Requests



Ran into an unexpected behavior when implementing an async version of WebClient to download data. While you can override WebClient to capture the HttpWebResponse object to capture additional Http information that is missing from the WebClient class, I initially had problems captureing the Respone on async requests. In this post I discuss a use case, problem and the simple solution.

AngularJs and Promises with the $http Service



The AngularJs $http object returns custom promises which can be surprising when you try to work with them. You can use either .then() or the easier .success() and .error() methods - at the cost of some inconsistency in Promise usage as these extension are specific to the $http functions. In this post I review a few different ways you can use promises and more importantly what the various $http methods return.

A jquery-watch Plug-in for watching CSS styles and Attributes



A few years back I wrote about a jquery-watch plugin I wrote that can monitor CSS property and Attribute changes and let you get notified if one of the monitored properties are changed. Unfortunately the plugin broke a while back as browser and jQuery dropped some older APIs. In this post I describe an update to the jquery-watch plugin using the newer and more widely supported MutationObserver API that brings high performance DOM node monitoring.

Chrome DevTools Debugging Issues



I've run into a nasty Chrome bug that I can't resolve: My debugger is frequently not stopping on debugger commands or breakpoints set in the debugger.

Capturing Performance Counter Data for a Process by Process Id



Process specific Performance Counters in .NET work directly only with Process Names, not Process Ids which can be problematic if you need to monitor performance of multiple instances of the same process. In this post I describe how you can capture multiple processes uniquely and monitor each individually.

A .NET QueryString and Form Data Parser



.NET is a bit short when it comes to tools that can manipulate UrlEncoded data. If you need to read, create or modify raw querystrings or form data outside of ASP.NET's System.Web context there isn't a clean way to do this and even there if you want to modify url encoded data you'll need to write some code. This article describes a UrlEncodingParser class that lets you read in raw query strings, form data or entire URLs, then lets read, add and update values and then write the values back out. Makes you wonder why that functionality doesn't exist natively somewhere in .NET, eh? Code and samples are provided.

The broken Promise of the Mobile Web



The Mobile Web has come a long way to provide the abillity to create rich UI and interactive, immersive and smooth Web based mobile applications. But there are still big gaps between mobile device features and what's available to Web developers when interacting with mobile devices. In this post I cover and contrast what's wrong with mobile Web development today and where I hope we are going, going forward.

Using FiddlerCore to capture HTTP Requests with .NET



If you have an application that needs to capture HTTP or monitor HTTP traffic, FiddlerCore is the tool you can use to do it easily. In this post I demonstrate how easy it is to integrate FiddlerCore into an application to capture HTTP requests and save the data, as well as discuss how to deal with configuring FiddlerCore for SSL Certificate installation for HTTPS captures.

West Wind WebSurge - an easy way to Load Test Web Applications



Recently I had a need for a load testing tool and after quite a bit of frustration to find a decent reasonably priced load testing tool, ended up giving up searching and building one instead. In this post I introduce West Wind WebSurge, an easy to use Web load testing tool that makes it easy to stress test Web applications.

Project Navigation and File Nesting in ASP.NET MVC Projects



Project navigation in large projects can be a pain as you have to sift through large amounts of files. I found myself re-organizing projects in a few different ways to make project navigation easier. In this blog post I share a few different approaches as well as some useful tooling to improve my daily workflow.

Nuget Dependencies and latest Versions



NuGet is a great component distribution mechanism and it's awesome for consuming components and getting them into projects. However, creating NuGet packages and getting the version dependencies worked out reliably has been a challenge. Specifically the way dependency versions are pulled in by NuGet are somewhat counterintuitive. In this post I look at some of the issues and bring up some thoughts of how this could work better.

A dynamic RequireSsl Attribute for ASP.NET MVC



In ASP.NET MVC the RequireHttps attribute allows for securing controllers and controller methods, but it's limited to either on or off statically. In this post I discuss a custom attribute that can dynamically set SSL usage based on a configuration setting or delegate.

AngularJs ng-cloak Problems on large Pages



Angular supports the ng-cloak directive to address hiding initially unrendered template content. I found out the hard way that sometimes with very large pages this mechanism doesn't quite work and still results in slight page flicker of the unrendered template content. In this post I describe the problem and several easy solutions to get around it the edge case scenario.

Creating ASP.NET MVC Negotiated Content Results



ASP.NET MVC doesn't directly support content negotiation, but with a little bit of work it's very straight forward to implement a NegotiatedContent ActionResult that can switch its response type based on the Accept header.

Filtering List Data with a jQuery-searchFilter Plugin



When dealing with HTML based list data, filtering that data based on search text is a nice UI feature that's very useful for quickly finding what you're looking for. In this post I show you how to can create this nice UI effect with a few lines of jQuery code, and then provide a jQuery plug-in that simplifies the process further.

IIS SSL Certificate Renewal Pain



IIS SSL Certificate renewals always seem to be a pain. Rarely does it just go right and I never seem to remember whether I should renew, or just issue a new cert. The answer is the latter, but this post discusses some of the issues and how to avoid them when renewing or installing new SSL certificates.

Westwind Application Configuration Updates



I've recently updated my code-first, class based application configuration library with a number of features and updates. This blog post discusses some of the changes and new features of this useful library.

Updated ASP.NET Database Resource Provider



I've updated my database ASP.NET Resource Provider project into a more formal project with a new home page, and official GitHub repository for the source code as well as a getting started video. In this video I talk about what's new and a few examples on how to use the provider.

Auto Selecting Cultures for Localization in ASP.NET



When creating multi-language Web sites, one of the key issues you need to deal with is how to assign a culture to display the appropriate resources. Whether you need to auto-switch locales based on browser language, or explicitly assign a locale based on user preferences there is generally some code logic involved in making these decisions. In this post I show what options are available and a small helper that simplifies setting the culture in ASP.NET applications.

Using CSS Transitions to SlideUp and SlideDown



CSS Transitions are a nice way to replace jQuery animations with smoother counterparts. Some transitions however, like height and width transitions can be tricky to handle with pure CSS code due to container sizing issues. In this post I show how create create transitions to mimic most of jQuery's slideUp() and slideDown() functions using CSS and small jQuery plug-in.

Forms Auth loginUrl not working after Windows Update?



Ran into a problem with Windows Update last week that seems to have broken forms authentication and the loginUrl attribute when set. Looks like new default settings are changing default behavior, and an extra configuration key is required to get the old default behavior back.

Using .NET HttpClient to capture partial Responses



Recently I needed to create a high volume monitoring application that retrieves a huge number of HTTP requests, and I need to minimize the amount of data pulled from these requests. In this post I describe some of the limitations in actually pulling an exact amount of data from an HTTP and Tcp/IP connection in .NET.

Book Review: Async JavaScript



This is a brief review of the Aysync JavaScript book by Trevor Burnham. It's great, small book that's easy to read and get through, that blazes through various Async concepts in a really easy to understand and practical way. Great read and highly recommended.

JavaScript JSON Date Parsing and real Dates



JavaScript doesn't have a date literal, and for this reason JSON serializes dates as strings rather than real JavaScript dates. In this post I show how JSON date serialization works, a few approaches how you can manage dates and how to automate the process of converting JSON dates to 'real' dates more easily.

Entity Framework and slow bulk INSERTs



While inserting a large number of records into a SQL database using EF Code First, I ran into some stunningly slow performance. In this article I show the problem and a couple of simple workarounds to this issue.

Dell XPS 15 review



I recently picked up new Dell XPS 15 to replace an older XPS machine. Lots of things to like about this machine - here's a quick review of what I liked and didn't.

Accepting Raw Request Body Content with ASP.NET Web API



One ASP.NET Web API related question that frequently comes up frequently is how to capture the raw request content to a simple parameter on a controller method. Turns out that's not as easy as it should be. In this post I discuss how to natively capture the raw request content and then create a [NakedBody] attribute that makes it easy capture the raw content in a string or byte[] parameter.

Re-examining ASP.NET and Helios Performance Tests



Spend a little time over the weekend re-running some of my ASP.NET raw throughput benchmarks on my new machine and found some interesting results. Much faster, but also some surprises with self-hosting and efficiency surprises with various Web API approaches.

Checking out the Helios IIS Owin Web Server Host



During last week's MVP summit Microsoft showed a new light weight, Owin host called Helios, that can run directly on the IIS core without using the ASP.NET Runtime. It's light weight and fast, and offers a glimpse into where Microsoft is heading for building a more nimble and componentized runtime that is bound to be more flexible and agile. In this post I describe how to set up Helios to play around with and some of the implications it brings.

Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality



Ran into an oddball debugger issue last week with an older project in Visual Studio 2013 where all breakpoints show 'Could not evaluate expression' instead of displaying values. This post shows the problem and a couple of ways around it.

Routes, Extensionless Paths and UrlEncoding in ASP.NET



When using custom routing in your ASP.NET applications be careful with encoding routes into paths. Specifically make sure that embedded route paths are properly encoded and that you watch out for a few gotchas related to path encoding. This post demonstrates how to set up routes for a WebForms app and demonstrates a couple of potential problems of manual route encodings and the fixes.

Dynamically loading Assemblies to reduce Runtime Dependencies



Using a static language like C# tends to work with hard assembly bindings for everything. But what if you want only want to provide an assembly optionally, if the functionality is actually used by the user? In this article I discuss a scenario where dynamic loading and activation made sense for me and show the code required to activate and use components loaded at runtime using Reflection and dynamic in combination.

Modern/Metro Internet Explorer: What were they thinking???



The 'Modern' version of Internet Explorer in Windows 8/8.1 is a full screen version Internet Explorer with a custom shell around it. This version of IE has a couple of pretty annoying quirks that affect Web pages significantly.

Routing to a Controller with no View in Angular



Angular provides a nice routing, and controller to view model that makes it easy to create sophisticated JavaScript views fairly easily. But Angular's views are destroyed and re-rendered each time they are activated - what if you need to work with a persisted view that's too expensive to re-render? Here's how to build a headless controller that doesn't render a view through Angular, but rather manages the the view or markup manually.

Prefilling an SMS on Mobile Devices with the sms: Uri Scheme



Popping up the native SMS app from a mobile HTML Web page is a nice feature that allows you to pre-fill info into a text for sending by a user of your mobile site. The syntax is a bit tricky due to some device inconsistencies, but here's how to do it.

Use IIS Application Initialization for keeping ASP.NET Apps alive



Ever want to run a service-like, always-on application inside of ASP.NET instead of creating a Windows Service or running a Console application? Need to make sure that your ASP.NET application is always running and comes up immediately after an Application Pool restart even if nobody hits your site? The IIS Application Initialization Module provides this functionality in IIS 7 and later, making it much easier to create always-on ASP.NET applications that can act like a service.

Disable User Account Control On Windows 8



User Account Control can be a real pain and in Windows 8 there's no easy way to turn it off. However, using Group Policy you can still completely disable it if you decide to do so. Here's how.

Hosting SignalR under SSL/https



Self-hosting SignalR is easy enough, but using a self hosted server under SSL/HTTPS requires a little extra configuration. This post shows what you need to know.

JavaScript Arrays, References and Databinding in Angular



Ran into a snag with Angular Databinding where items added to an array $scope variable were not 'overwriting' other array elements. Turns out this isn't an Angular issue, but a JavaScript referencing issue, that can be easy to miss when using data binging.

Self-Hosting SignalR in a Windows Service



Being able to Self-Host SignalR in standalone applications on the server side opens up all sorts of opportunities for dashboard and notification style applications. In this post I show an example of a Windows Service that integrates SignalR to provide real time status updates and describe the required pieces in detail.


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2015