Working with Azure Blobs through the .NET SDK

Azure is my cloud of choice. Not only because you get free stuff, yes you do, but also because of the flexibility and ease of interacting with it. If you don’t have an Azure account, you can register for free here. One of the features offered by Azure is Storage. There are 3 types of Storage: Blobs: used to store files, images, binary data, or video Drives: which can be mount on VMs etc like an external drive but virtual Tables: scalable structured storage which acts like a database table but with slightly different behaviour and structured. You can …[read more]


My thoughts on TechEd 2014 announcements

Are you following this? Are you watching the videos? I think Channel9, the official Microsoft media outlet, died from overwhelming demand. The cynics may say that this is because of technical issues, however, I say that this is due to a highly demanding audience :). If you have been unable to watch the live stream, rest assured that all recordings will be available online soon (usually withing 48hrs). It's only been a month since the //Build event where Microsoft announced a host of new features, open sourced their new Roslyn compiler, and brought the mobile, desktop and gaming platforms together under …[read more]


Working with DbGeography, Points and Polygons in .NET

One very handy feature of the System.Data.Spatial namespace is the DbGeography class that allows you to work with either points on a "map" or shapes/polygons. To create a DbGeography point object you need to know the latitude and longitude of that point. There are many services that allow lookup these values for a given place, so we can pass the string "Glasgow" and get back the values 56.033113,-4.789563 as a latitude/longitude pair. How can we convert these values to a DbGeography point? Like this: public static DbGeography ConvertLatLonToDbGeography(double …[read more]


The right way to implement password hashing using PBKDF2 and C#

Following from my previous post about hashing using BCrypt and in response to some comments I received on Google+, I decide to provide an alternative hashing implementation using PBKDF2. As you will notice, the implementation is somewhat bigger than the one provided for BCrypt but in effect, both code segments perform the same task. First we create a hash from the plain text password and then we validate a password against the stored hash. NOTE: The constants, like the iterations, can be changed to tweak the hash strength. The code above is pretty self explanatory. You call PasswordHash.HashPassword(plaintext) …[read more]


A simple .NET password hashing implementation using BCrypt

By now, you've heard many many stories about compromised sites and how millions of emails and clear-text passwords have made it to the hands of "not so good" people. If you are a developer and you need to create some kind of authentication for your clients/software/site/pet-project, please make sure you approach this with the gravity that it demands. Troy Hunt, a security expert has written about the subject multiple times and I would urge you seriously to have a look at his blog or his pluralsight courses. Troy is one of the many security experts …[read more]


WebApi controller action with comma-separated parameter values

Today I've run across an issue where I had to create a WebAPI GET action that could accept, among other things, a parameter with comma-separated values. If you ever need to implement this, then that's one way to do it: Create an action filter### The action filter will be used to intercept the action call and process the comma-separated parameter. Then, you simply assing the action filter to the controller action and you can carry on with the next task at hand. A practical example### First, let's create the action filter. Create a new class and name it something like …[read more]


Configuring SQL Server Always On Availability Groups in Azure - Part 3

This is the last of the 3 part blog series where I will explain how to setup Always On using primarily PowerShell and a little bit of GUI. In this section we discuss how to setup and test the Always On SQL Server functionality Prerequisites### You have already completed Part 1 and Part 2 of the series. Part 3 - Prepare the cluster nodes for Always On### You can simply copy paste the code below and execute it step by step in order to implement Part 3 ########################################################## #Step: 1 #Description: Start an Azure PowerShell session # Or start an elevated PowerShell …[read more]


Configuring SQL Server Always On Availability Groups in Azure - Part 2

This is part 2 of a 3 part blog where I will explain how to setup Always On using primarily PowerShell and a little bit of GUI. In this section we discuss how to install and configure the Windows Server Failover Cluster in Azure to support the Always On functionality Prerequisites You have already completed Part 1 of the setup as described here. Part 2 – WSFC configuration You can simply copy paste the code below and execute it step by step in order to implement Part 2 ## PREPARE THE ENVIRONMENT FOR THE CLUSTER DEPLOYMENT ## ########################################################## #Step: 1 #Description: Start an Azure …[read more]