The Blog
Exploration Of Thought
Thoughts on autonomy, self direction, digital business and life.

Force HTTPS on all requests, HttpModule
How to force every request to HTTPS in classic ASP.NET with a simple IHttpModule, instead of relying on IIS settings or per-page redirects.
Donn Felker – February 3, 2007
Prototype/Proof of Concept code is not production code!
Prototype and proof-of-concept code exists to align with clients, not to ship. Why POC code should never be repurposed into your production app.
Donn Felker – February 2, 2007
The “as” Keyword
A C# 'as' cast gotcha: casting a boxed value type to string silently returns null instead of throwing, unlike a direct cast. Know your types.
Donn Felker – January 30, 2007
New Lines
Stop hardcoding carriage-return-and-newline pairs in your C# strings. Use the built-in Environment.NewLine property so your code adapts to any platform.
Donn Felker – January 17, 2007
Escaping String Literals
A simple C# trick: prefix a string with @ to stop escaping backslashes in file paths, plus the one case where it still trips you up.
Donn Felker – January 14, 2007

Warnings as Errors
Why I configure every .NET project to treat compiler warnings as build-breaking errors, and how to turn it on in Visual Studio or csc.exe.
Donn Felker – January 11, 2007
ASP.NET File Name at Runtime
A quick ASP.NET snippet and base Page class for grabbing the current page's file name at runtime without repeating the same helper everywhere.
Donn Felker – January 10, 2007
Hiding Code From The Debugger
Tired of stepping through helper methods you already know work? The DebuggerHidden attribute tells the debugger to skip that code entirely.
Donn Felker – January 9, 2007
Conditional Switch Statement with Enumeration String Value
How to switch on a string value of a C# enum without hitting the 'a constant value is required' compiler error - just Enum.Parse it first.
Donn Felker – January 6, 2007