Blog Archives

Detect and Reflect a Generic List

A pool table at the Biltmore Estate
A pool table at the Biltmore Estate

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 entry
Advertisements

The Expando Object

Mushrooms
Just some mushrooms

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.

Read the rest of this entry

Linq to CSV

Linq to CSV

Something Old

Something old

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.

Read the rest of this entry

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.

Web Services Description Language Tool on MSDN.

Read the rest of this entry

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.

Security Authorization

ASP.NET Authorization