Life, Surf, Code and everything in between
Recent Weblog Posts
Using FiddlerCore to capture HTTP Requests with .NET
Yesterday @ 2:03am
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
July 15, 2014 @ 2:06am
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
June 30, 2014 @ 10:28pm
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
June 19, 2014 @ 5:52pm
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
June 18, 2014 @ 1:37am
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
June 02, 2014 @ 4:38pm
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
May 20, 2014 @ 9:13pm
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
May 12, 2014 @ 12:48pm
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
May 08, 2014 @ 1:53pm
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
April 29, 2014 @ 3:33am
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
March 31, 2014 @ 5:53pm
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
March 27, 2014 @ 5:11am
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
February 22, 2014 @ 2:48am
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?
February 15, 2014 @ 3:15am
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
January 29, 2014 @ 5:50pm
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.
January 09, 2014 @ 4:58pm
January 06, 2014 @ 10:52am
Entity Framework and slow bulk INSERTs
December 22, 2013 @ 10:30am
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
December 19, 2013 @ 3:36am
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
December 13, 2013 @ 3:35am
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
December 09, 2013 @ 2:17pm
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
November 23, 2013 @ 8:42pm
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
November 21, 2013 @ 11:12am
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
November 14, 2013 @ 8:13pm
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
November 12, 2013 @ 4:05am
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???
November 04, 2013 @ 2:19am
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
October 15, 2013 @ 1:56pm
Prefilling an SMS on Mobile Devices with the sms: Uri Scheme
October 09, 2013 @ 10:04am
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
October 02, 2013 @ 1:42pm
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
October 01, 2013 @ 9:09pm
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
September 23, 2013 @ 2:55am
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.
September 16, 2013 @ 2:52pm
Self-Hosting SignalR in a Windows Service
September 04, 2013 @ 4:54pm
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.
The Search Engine Developer
August 24, 2013 @ 3:33am
Today's Search Engines make developers much more productive thanin the past with untold mountains of developer content at our fingertips. But are we getting lazy because of it, using the search engine as a crutch and losing our edge as developers?
IIS Default Documents vs. ASP.NET MVC Routes
August 15, 2013 @ 8:38pm
ASP.NET MVC's routing takes over extensionless URLs and if you want to serve static default document using IIS's default settings you need to make sure you ignore the default route.
Rendering ASP.NET MVC Razor Views outside of MVC revisited
July 15, 2013 @ 1:48pm
Rendering ASP.NET MVC Views outside of the context of MVC can be immensely useful for various administration, error and logging tasks. Luckily there are some easy ways to render MVC even outside of an MVC controller. Here's some information on how to make that happen.
HTML5 and CSS3 Editing in Windows Live Writer
July 08, 2013 @ 10:28am
Windows Live Write is an excellent tool for editing, managing and publishing blog posts effectively. It includes a nice WYSIWYG editor for editing posts which can work off your blog's CSS styling. Unfortunately Live Writer does not use CSS3 or HTML5 as it's stuck using the IE 7 engine for rendering its live preview and editing mode. Here's a workaround to get Live Writer to render your blog theme using HTML5 and CSS3.
Using HTML 5 SessionState to save rendered Page Content
July 01, 2013 @ 3:46pm
SessionStorage and LocalStorage provide easy client side storage for Web applications. In this post I describe a specific scenario for caching list display data and state for a server rendered HTML application using sessionState. See how you can make a server rendered HTML application more user friendly and faster caching content on the client and redisplaying it when the user returns to a page he navigated from.
Fixing a SkyDrive Sync Disaster
June 21, 2013 @ 8:27am
Recently I ran into a major sync problem with SkyDrive, where SkyDrive decided to update my synced folders with older data from the server, overwriting newer local files. After mangling thousands of files I ended up creating a small utility that lets me look and update these files in bulk. This post discusses the issues and provides a utility to facilitate fixing the problem.
Replacing jQuery.live() with jQuery.on()
June 12, 2013 @ 11:40am
In jQuery 1.9 and later the jQuery.live() function has finally been removed which has caused me a bit of upgrade trouble. While jQuery.live() has been deprecated for a while now since 1.7, 1.9 actually removes the function. In this post I describe how you can use the .on() function to replace existing .live() code with a little bit of extra work.
Setting up and using Bing Translate API Service for Machine Translation
June 06, 2013 @ 2:52am
Public translation APIs as a Web Service are great for doing machine translation within applications or casual translation for user input in many applications. With Google recently removing Google Translate API I've been looking at alternatives and so wanted to hook up to the still supported Bing Translate API. Unfortunately the signup process for the Translate API is terrible, although using the service is easy enough once signed up. In this post I discuss step by step how to sign up and how to use the Translate API.
Smoothing out <div> scrolling in Mobile WebKit Browsers
June 01, 2013 @ 6:13pm
Webkit mobile browser's default scroll behavior is terrible. Default scrolling is slow and it chokes on larger lists becoming erratic or appearing to lock up altogether. Luckily there's an easy workaround using the -webkit-overflow-scroll style, but it too comes with a few caveats. Here's more info.
A first look at SignalR
May 22, 2013 @ 5:23am
Last month I finally had a chance to use SignalR in a live project for the first time, and I've been impressed by what this technology offers to .NET developers. It's easy to use and provides rich real-time two way messaging between client and server applications, as well as the ability to broadcast message to all connected clients. This is technology that offers many opportunities to rethink of what we can build with Web applications.
Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 @ 2:29am
Visual Studio 2012 Update 2 introduces a little known new Web Publish feature that allows publishing individual files to the server. While not a high frequency usage case, it's handy for content files or when you just published a large project and realized you forgot to include a file in the project to publish.
A WebAPI Basic Authentication MessageHandler
April 30, 2013 @ 3:29am
In my last post I showed how to create a basic authentication filter for custom authentication within your applications. This time I repeat the excercise with a MessageHandler to demonstrate the differences between the two approaches.
A WebAPI Basic Authentication Authorization Filter
April 18, 2013 @ 11:35am
Recently I needed to implement user based security in a Web API application that's easily accessible from a variety of clients. The customer asked specifically for Basic Auth support and so needed to implement custom Basic Auth support. In this post I describe a simple AuthorizationFilter based implementation of Basic Authentication for Web API.
WebAPI: Getting Headers, QueryString and Cookie Values
April 15, 2013 @ 3:48am
Finally got tired to trying to remember how to get at the Headers, Cookies and QueryString 'collections' in Web API, since there's zero consistency and messy nested collections to deal with. Here's are a set of extension methods that make it easier.
UNC Drive Mapping Failures: Network name cannot be found
April 04, 2013 @ 11:58pm
Ran into a nasty issue yesterday trying to map a remote drive via UNC pathing. Basically I was unable to connect with failures occurring instantly and without prompting for credentials even when asking to use different credentials. Turns out the problem is the Network Provider Order - here's more info.
A small, intra-app Object to String Serializer
April 01, 2013 @ 2:41am
On a few occasions I've needed a very compact serializer for small and simple, flat object serialization, typically for storage in Cookies or a FormsAuthentication ticket in ASP.NET. XML and JSON serialization are too verbose for those scenarios so a simple property serializer that strings together the values was needed. Originally I did this by hand, but here is a class that automates the process.
Experimenting with Online Backups
March 27, 2013 @ 2:07pm
I recently spent a bit of time looking at online synching/backup software to provide a little more resilience to my backup situation. Lots of choices but nothing that's really quite perfect yet. Here's what I found.
Firing an Entity Framework Database Initializer from within DbContext
March 26, 2013 @ 12:53pm
Database initializers in Entity Framework can be a pain, especially when you're using EF as part of smaller components that may or may not load into a database shared with other EF Contexts. Here's a small helper utility that lets you internalize the database initializer and fire it the first time the context is loaded.
Text Editor Associations/Extensions in Visual Studio getting lost
March 22, 2013 @ 6:47pm
Visual Studio allows you to create text editor extensions that map standard Visual Studio editors to custom extensions. It's a useful feature that I use a lot with some older products, but unfortunately I've seen alot of cases where the editor/extension mapping gets lost even though Visual Studio still shows it as registered. Here's more info on the problem and how to fix it at least temporarily.
Using plUpload to upload Files with ASP.NET
March 12, 2013 @ 3:42am
plUpload is a popular client side multi-file upload component. In this article I describe a small library that abstracts the server side processing of uploaded files with an HTTP handler demonstrate putting it all together with a small Image Upload sample application.
Sql Connection Strings in .Config Files vs. Source Control
February 27, 2013 @ 12:18pm
Connection strings in projects under source control can be problematic. Each Source Control user can potentially have different connection settings to use a database connection and these differences can't be easily reconciled via Source Control. Here are a couple of approaches that have worked for me to deal with this issue.
Visual Studio Web Publish Lockup? Check for invisible Window
February 21, 2013 @ 12:25am
If your Web Publish dialog appears to lock up Visual Studio when you click on the Publish option, most likely the Web Publish window is hidden on a second screen that is not currently visible. Here's how you can work around this annoying little bug.
Building a better .NET Application Configuration Class - revisited
December 28, 2012 @ 4:41am
Managing configuration settings is an important part of successful applications. It should be easy to ensure that you can easily access and modify configuration values within your applications. If it's not - well things don't get parameterized as much as they should. In this post I discuss a custom Application Configuration class that makes it super easy to create reusable configuration objects in your applications using a code-first approach and the ability to persist configuration information into various types of configuration stores.
Process.Start() and ShellExecute() fails with URLs on Windows 8
December 12, 2012 @ 8:14pm
It appears that on Windows 8 there's a bug in the ShellExecute() API that causes failure in URL navigation when running under Administrative privileges.
A Small Utility to Delete Files recursively by Date
November 30, 2012 @ 9:13pm
After again searching for a script or tool that can easily delete files recursively down a folder hierarchy with a date filter and coming up with several 'almost there' solutions I sat down and created a small Console app that handles this task. I've posted the resulting project on Github, with both the binary and source code, in case you ever find yourself with the same need.
Set-Cookie Headers getting stripped in ASP.NET HttpHandlers
November 29, 2012 @ 5:38pm
Ran into a nasty problem with Cookies not getting sent in HttpHandler code when using Response.AppendHandler() with the Set-Cookie key. It turns out it's a very narrow edge case, but one that can bite in unexpected system level applications.
WCF WS-Security and WSE Nonce Authentication
November 24, 2012 @ 5:31am
I ran into a Web Service last week that required WS-Security headers with an embedded nonce value. Unfortunately WCF doesn't support this particular protocol directly. Here's how to create custom credentials and a tokenizer to write out the customized WS-Security header.
Windows 8 Live Accounts and the actual Windows Account
November 19, 2012 @ 8:10pm
When you log on with a Windows Live account in Windows 8, what really happens to your credentials? It's not quite obvious, so here are a few thoughts and examples that demonstrate the relationship between Windows and Live accounts.
DevConnections Session Slides, Samples and Links
November 13, 2012 @ 5:20am
Finally getting around to posting links to my DevConnections session in Vegas a couple of weeks ago. It was a fun time after a long absence from speaking...
HTML5 Input type=date Formatting Issues
November 08, 2012 @ 6:27pm
The new HTML5 Input types make it easier to display special formatted input types like dates and email addresses. Browsers that support them display a nice UI for editing and can validate values. However, support currently is limited and date formatting especially is complex as it involves using an ISO date format that doesn't fall back nicely to non-supporting browsers.
Back to Basics: When does a .NET Assembly Dependency get loaded
November 03, 2012 @ 4:39pm
Assembly loading in .NET is often a cause of confusion. So many times I've heard how evil it is to add a reference to some big assembly, if it's just a minor feature. But .NET is really smart in assembly loading and by default uses just in time loading of referenced assemblies. In this post I review when assemblies are loaded with a few simple examples that demonstrate the process.
Caveats with the runAllManagedModulesForAllRequests in IIS 7/8
October 25, 2012 @ 11:15pm
IIS 7 and 8 support using Managed Modules to handle access to all IIS request content which is very powerful. But sometimes you actually want to not handle non-ASP.NET content and it's not very obvious how to minimize access to non-ASP.NET requests in managed modules.
Dynamic Code for type casting Generic Types 'generically' in C#
October 23, 2012 @ 2:06am
Here's a short entry on how dynamic can be a life saver when you can't cast a type between multiple objects, specifically when the object in question is a generic type without a common base type to cast to.
A tiny Utility to recycle an IIS Application Pool
October 02, 2012 @ 3:29am
Here's a small console app to recycle an Application Pool which seems to be something I've needed to do repeatedly in the past.
Creating STA COM compatible ASP.NET Applications
September 18, 2012 @ 6:36pm
When it comes to deploying STA COM components in ASP.NET only WebForms has native support for STA component. Other technologies like MVC, ASMX Web Services and WCF run only in MTA mode. If you need to run your STA COM Components in ASP.NET here is what you need to know and a few tools that help you create STA compatible handlers.
Passing multiple simple POST Values to ASP.NET Web API
September 11, 2012 @ 4:27am
One feature conspicuously missing from ASP.NET Web API is the inability to map multiple urlencoded POST values to Web API method parameters. In this post I show a custom HttpParameterBinding that provides this highly useful functionality for your Web APIs.
ASP.NET Frameworks and Raw Throughput Performance
September 04, 2012 @ 6:13pm
I got curious the other day: How do the various ASP.NET framework compare in raw throughput performance? With so many development choices on the ASP.NET stack available today it's interesting to take an informal look at how raw throughput performance compares.
Using JSON.NET for dynamic JSON parsing
August 30, 2012 @ 5:04am
Parsing JSON dynamically rather than statically serializing into objects is becoming much more common with today's applications consuming many services of varying complexity. Sometimes you don't need to map an entire API, but only need to parse a few items out of a larger JSON response. Using JSON.NET and JObject,JArray,JValue makes it very easy to dynamically parse and read JSON data at runtime and manipulate it in a variety of different ways. Here's how.
.NET 3.5 Installation Problems in Windows 8
August 27, 2012 @ 3:32pm
I ran into a major headache with getting .NET 3.5 properly on my Windows 8 install - although installed SP1 was missing and wouldn't properly install. Here's what happened, how to check for the version actually installed and how to work around it.
An Introduction to ASP.NET Web API
August 21, 2012 @ 2:41am
This article is a hands on tour of ASP.NET Web Api. It covers a fair variety of functionality and goes beyond the most basic introductions by digging into some of the mundane details you're likely to run when first starting out with Web API.
Mapping UrlEncoded POST Values in ASP.NET Web API
August 16, 2012 @ 12:42pm
Surprsingly Web API does not support POST value mapping to multiple simple parameters on a Web API endpoint. While you can map POST values with model binding or the FormDataCollection native parameter mapping in Web API is a missing feature. Here's what you can and can't do with POST values in Web API.
Where does ASP.NET Web API Fit?
August 07, 2012 @ 4:34pm
With the pending release of ASP.NET Web API we're finally getting a good HTTP Service solution 'in the box ' in ASP.NET. Web API provides many needed and cool features, but it's not always clear whether you should use Web API or some other technology like MVC to handle HTTP service requests. In this post I discuss what Web API is and a few options of where it fits and potentially doesn't fit.
July, 2014 (2)
June, 2014 (4)
May, 2014 (3)
April, 2014 (1)
March, 2014 (2)
February, 2014 (2)
January, 2014 (3)
December, 2013 (4)
November, 2013 (5)
October, 2013 (4)
September, 2013 (3)
August, 2013 (2)
July, 2013 (3)
June, 2013 (4)
May, 2013 (2)
April, 2013 (5)
March, 2013 (4)
February, 2013 (2)
December, 2012 (2)
November, 2012 (7)
October, 2012 (3)
September, 2012 (3)
August, 2012 (5)
July, 2012 (1)
Visual Studio (37)
Web Services (17)
Web Api (16)
Microsoft AJAX (8)
Sql Server (7)
Web Connection (7)
West Wind Ajax Toolkit (7)
Live Writer (5)
Html Help Builder (5)
Visual Studio (4)
Entity Framework (4)
Source Control (4)
Software Development (3)
Help Builder (3)
Internet Explorer (2)
Web Deployment Projects (1)
Web Design (1)
Control Development (1)
Dynamic Types (1)
© Rick Strahl, West Wind Technologies, 2005 - 2014