THE BLOG
Exploration of Thought
Thoughts on autonomy, self direction, digital business and life.
Force HTTPS on all requests, HttpModule
Sometimes we have websites that are strictly HTTPS. No files whatsoever are served up through HTTP. We want our users to only access the HTTPS portion of our website but we dont want them to remember "https://" blah blah blah. Honestly, who really wants to type all of that anyway? No one. We want our…Donn Felker - February 3, 2007
Prototype/Proof of Concept code is not production code!
One thing that should be burned into the heads of many developers is that Prototype/Proof of Concept (PoC) code is NOT production code. Proof of Concept code is not production code.Prototype code is, more or less, proof of concept. When you create a prototype or PoC, it’s something that can be shown to the client…Donn Felker - February 2, 2007
The “as” Keyword
Last week I ran into a problem with the 'as' keyword in C#. For those of you who dont know, the "as" keyword works like this: Lets say I have a variable and I'm certain its a string, but its in the form of an object (for whatever weird reason, perhaps you're getting it out…Donn Felker - January 30, 2007
New Lines
Lines are represented differently in different operating systems. For most non Unix Platforms the new line is represented as: "\r\n" And for Unix Platforms the new line is represented as: "\n" I've found that most developers will hard code these values into their code, for example: string someText = String.Format("This is a line1.{0} This is…Donn Felker - January 17, 2007
Escaping String Literals
I've been looking through a lot of "hand me down code" (code that was written awhile ago by someone else) that did a lot of File IO. The code works well, but at times its hard to read the really long file paths that they're using. As you know, file paths in C# have to…Donn Felker - January 14, 2007
Warnings as Errors
Warning: A: To give notice to beforehand especially of danger or evil B: To give admonishing adviceC: To call to one's attentionWith that said, we could infer that a warning is something that says "Hey, this is kind of important, you might want to watch this." To me, in .NET Development, a warning means I've…Donn Felker - January 11, 2007
ASP.NET File Name at Runtime
Retrieving the ASP.NET filename can be done in many ways. I've created this method in a few helper classes in some of the different jobs I have. public string GetCurrentPageFileName(){ return new System.IO.FileInfo(Request.PhysicalPath).Name;}I've also created a base page class in the past to hold these types of methods (below). /// <summary>/// Base Page class/// </summary>public…Donn Felker - January 10, 2007
Hiding Code From The Debugger
Sometimes there are methods in code that my development department knows are robust. There are no bugs in the code. This might be helper methods that have been tested time and time again. Therefore we know we dont need to debug these methods 99% of the time. To alleviate the pain of stepping through unnecessary…Donn Felker - January 9, 2007
Conditional Switch Statement with Enumeration String Value
As of recently I've had a few requests for how I handle a string representation of an Enumeration in a conditional switch. If you pass in a string into the switch statement without parsing the enumeration .NET will complain about a constant value being required. Here's how to write switch statement with a string respresentation…Donn Felker - January 6, 2007