Blog Archives
Thinking Outside The Box

I could really write a few things with that title. As developers we often take the path of least resistance or of most familiarity. Usually this is good because we are using best practices or some other coding standard. Sometimes, these well worn trails are not always the best.
Read the rest of this entryMy Json Date Lost Its Offset
What Happened

I was using NewtonSoft like so many of us for Json Serialization and Deserialization. In this case I was trying to make sure our DateTimes were being returned in a proper ISO8601 format, defaulting to UTC unless a flag was set. If the flag was set it would then use the offset associated with a customer’s location, never to use the browser’s offset.
Sadly it was always rendering in Postman and SoapUI in my local time zone. Even when I would debug through the code, the return Ok(jsonObject); had the expected time zone and format.
Read the rest of this entryDetect and Reflect a Generic List

We have a project that uses reflection quite a bit. If you use any kind of mapper chances are you too are using reflection. One gotcha with reflection is the name of the properties, unless you make some other infrastructure to support mapping one name to another chances are you won’t get the data you desire.
Read the rest of this entryThe Expando Object

The Expando object has been around for a while. In fact it was in .NET 4.0, in the ancient days of 2009.
I am sure, that back then, I must have thought that it was neat. Maybe a bit like JavaScript, but I never had a use for it until recently.
Linq to CSV
Linq to CSV
This post is about something old, something I should have posted about a long time ago. A few years ago I had to use a CSV file as a data source for some process. I had forgotten all about it until recently when I was looking through some old projects, they definitely brought back some memories.
I do remember thinking there has to be a better way to access a CSV file more like a database and have it populate an object. I started to get my frame of mind all set to come up with a solution when I thought how dumb it is to re-invent the wheel. So I did a search first, and found the LinqToCsv package.
The WSDL Tool
The WSDL tool is a handy tool to generate a proxy class to consume a web service. There is plenty of information out there about it, so I will not go into detail. I will provide some links though. One bit of advice is to add a new Environment Variable to your machine. Here is an example, I named mine Path.
Variable name: Path
Variable value: %PATH%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
You may need to verify that path on your actual machine, it should be the location of wsdl.exe.
Encrypt That ViewState!
Something that is probably over looked from time to time unless you are just always that secure is encrypting your ViewState. While SSL may prevent some things you will may want to make it a bit harder for an end user to see the information stored in ViewState.
Luckily this is very simple. You can set it in the @Page directive (<%@ Page Language=”C#” ViewStateEncryptionMode=”Always” %>) or in the web.config file (<pages viewStateEncryptionMode=”Always” />).
Of course, like many things .NET there are many ways to do this depending on your specific situation. For that amount of detail you should read the ViewState Overview.
Web.Config & URL Authorization
If you are making the change to IIS 7 and you use your web.config file to control access there are a couple things you need to know.
This is known as URL Authorization and has changed a little from the older versions of IIS. In the past we could just make sure the site was set to integrated authentication and then set our web.config authentication mode with authroization allow/deny settings and be happy.
I have been learning the hard way there is a bit of a change for those using IIS7 or better. To explain it best I will simply use a couple links to the information I have found.