Symmetric Hashing With .NET Crypto Service Providers and COM Interop

I wrote the DotNetCryptoCOM (DNCC) library because I  wanted to be able to generate and reverse cypher text between .NET and COM applications using a single .dll.  It allows developers to drive the builtin .NET Cryptographic Service Providers with a simple API.  I’ve used this lib in VB, Managed C++, and of course C# applications.  Some ofContinue reading “Symmetric Hashing With .NET Crypto Service Providers and COM Interop”

A config-based approach to pluggable composition

I wanted to share this sample to demonstrate a simple way to implement a configuration based approach to switching out pluggable dependencies.  The example here uses reflection to dynamically load an assembly and then instantiate the targeted class contained therein.  The idea with this approach is that you may have different implementations of an interface containedContinue reading “A config-based approach to pluggable composition”

Simple Random Password Generator

  Simple C# function to generate random passwords:   Random randomizer = new Random(); public string CreateTemporaryPassword(int length) {     string letters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";     var chars = new char[length];     for (int i = 0; i < length; i++)         chars[i] = letters[randomizer.Next(0, letters.Length)];     return new string(chars); }

TSQL function to parse delimeted string and return a memory table containing the values

This script is useful when you need to generate a rowset from a delimeted string.  It allows the "WHERE IN" clause to be used against the values in the string, because they are converted into table rows.  This UDF is designed to be plugged into other queries where this need is present.  Here’s an example ofContinue reading “TSQL function to parse delimeted string and return a memory table containing the values”

AutoFocus the UserName field of an ASP.NET Login Control

Even if you’re not using a templated version of the Login Control, the builtin TextBox for username entry can be targeted like this: protected void Page_Load(object sender, EventArgs e){            SetFocus(Login1.FindControl("UserName")); }  SetFocus is in the Page class. Easy joy..