Larry Steinle

February 27, 2011

Reading Data in Active Directory

Filed under: Active Directory,VS.Net — Larry Steinle @ 9:06 pm
Tags: , ,

There are three ways to get data from Active Directory programmatically. There is the Active Directory COM APIs, ADsDSoObject OLEDB driver, or .Net Directory Services. Both the OLEDB driver and the .Net Directory Services are wrappers around the COM APIs. In today’s post I will demonstrate how to read data using the OLEDB driver and the .Net Directory Services object model.

(more…)

February 21, 2011

AD Path Helper

Filed under: Active Directory,RegEx,VS.Net — Larry Steinle @ 11:57 am
Tags: , ,

In the previous post, Introduction to Active Directory, we learned that ADSI paths are used to organize objects in Active Directory. A path consists of a protocol, host name, port number and distinguished name (DN). A DN consists of one or more relative distinguished names (RDN). An RDN is a simple key/value type. Today we will create three helper classes to ensure that our paths are well-formed with escaped special characters. (more…)

February 20, 2011

Use Regular Expressions to Detect SQL Code Injection

Filed under: RegEx,Security,SQL Server,VS.Net,Web — Larry Steinle @ 12:26 am
Tags: , ,
To gain unauthorized access and possibly control of another companies information hackers employ a technique called SQL Code Injection. This simple technique involves entering a sql statement inside a text box and submitting the request. When the server processes the page it can be tricked into executing the injected code. The best strategy to block SQL Code Injection is to use a stored procedure. For the times when you simply must use inline sql statements we will learn how to detect and block SQL Code Injection with the help of a few, simple, regular expressions.

(more…)

January 30, 2011

String.Split On Steroids

Filed under: RegEx,VS.Net — Larry Steinle @ 9:25 am
Tags: , , , , ,

The String.Split function uses a separator to divide a string value into an array of string values. Unfortunately the split function does not support text qualifiers. As a result, if the separator is contained within a text qualified block of characters, the text block gets split.

In this article we will create a new extension called, FullSplit, that will implement the same basic functionality of the String.Split function with the added support of text qualifiers and assignment operators. When assignment operators are used the return value will be of type StringDictionary where the left side of the operator represents the DictionaryEntry.Key property and the right side represents the DictionaryEntry.Value property.

Finally we will conclude the article by updating the code from a previous post, Extending IEnumerable, to support dictionary entries by separating the key/value pair with an operator.

(more…)

January 25, 2011

Extending IEnumerable

Filed under: VS.Net — Larry Steinle @ 11:57 pm
Tags: , , , , , , , ,

Often there is the need to take a string value and split it into an array of values. String.Split provides a quick and convenient method to split strings (as long as you don’t have to worry about text qualifiers). Today I ran into the opposite scenario. I needed to combine the different iterations of an array into a single string value.

Immediately my mind turned to extensions. A beautiful, simple and elegant solution.
(more…)

Can’t Find System.Runtime.CompilerServices.Extensions in VS.Net 2010

Filed under: VS.Net — Larry Steinle @ 10:49 pm
Tags:

We’ve all been there. It’s that silly, nagging thing that slows you down. You know the answer is obvious but you just can’t figure it out in a second. You know the developer beside you will point it out in an instant if you show them but your too proud to say anything.

It happens to all of us at one time or another…And another…And another. I digress…
(more…)

« Previous Page

Blog at WordPress.com.