I found a trick for loading ASP.NET connectionString elements from configuration files for use in PowerShell scripts, and I figured I would share it with the class. They are, as should have been obvious to me much sooner, simply XML nodes …
Tagged: dot-net
Using ASP.NET connection strings in PowerShell scripts
Tags:ASP.NET/C# image resizer for responsive layouts
Tags:I will probably elaborate on this a bit further when I find some more time, but for now, this post is going to be mostly code. What I have here is a relatively simple way to generate images that are resized server-side based on the screen …
Validating file uploads in Sitecore WFFM
Tags:Our Sitecore installation was in dire need of a way to lock down file uploads on forms built with the Web Forms for Marketers (WFFM) module; out of the box, it doesn't do any checking at all, which can lead to some risky situations. I …
LDAP authentication with C#
Tags:LDAP, or Lightweight Directory Access Protocol, is a convenient, central repository for a system's personnel information. LDAP (and other Active Directory services) are widely-used by organizations big and small to consolidate user …
rexCrawler and HelpfulHighlighter are now open source
Tags:After having dipped my toe in the water of open source with some Arachni module changes and the development of a simple WordPress plugin, I've finally taken the plunge; two of my personal projects are now completely open source, and …
Using WSE 3.0 with Visual Studio 2008 and .NET 3.5
Tags:While I'm sure many of you have "moved on" to Visual Studio 2010, there are a large number of us still using 2008. Recently, my shop needed to write some code for interfacing with a vendor's web services. No problem, right? …
Check all CheckBoxes in a GridView using jQuery
Tags:If you're working with a GridView control where you've built a CheckBox control into each row of data displayed, odds are, it would be convenient for your users if a "Check/Un-check All" option was available. The following …
Custom error messages with ValidationSummary in ASP.NET
Tags:Sometimes, there are problems encountered in a code-behind file that don't warrant the extra work and mark-up that would otherwise be required to add CustomValidator controls to the page for displaying error messages to the user through …
Programmatically modifying file permissions in .NET
Tags:For one reason or another, somewhere down the line, you're probably going to want to modify a file's access permissions from your code. Maybe your users have a nasty habit of overwriting them, or you want to ensure that newly-created …
Image dimension Field Validator for Sitecore CMS
Tags:This StandardValidator extension will determine whether or not a given ImageField's source image's height and width match with given parameters. Either parameter can be omitted if, for instance, you only care about validating the width of …
Currency Field Validator for Sitecore CMS
Tags:This StandardValidator extension will determine whether or not a given field value passes for currency. In order to do so, it must meet the following requirements: It must pass decimal.TryParse() It must not have more than 2 digits past …
bulkRename v1.1
Tags:A while back (in 2008), I wrote a simple system utility with VB.NET which leverages the power of regular expressions to rename files in bulk according to a pattern. I've had to use it several times recently after placing it on a …
Replacing MS Word's quotation marks in VB.NET
Tags:When dealing with text pasted from Microsoft Word, the presence of "special" (read: non-ASCII) quotation marks and apostrophes can be quite troublesome. Here's a simple way to convert them to "standard" (read: ASCII) …
Files as Resources in .NET projects
Tags:Have you ever found that sleek application you wrote slowly becoming scattered over time with the use of external files? Say you want to create a simple GUI application that can be distributed as just an executable file. What if you want …
Retrieving user properties from LDAP with VB.NET
Tags:As discussed in an earlier post, LDAP can be a wonderful tool for centrally storing user information and credentials. I've written about how to authenticate against the LDAP repository… but what if you're just looking for …
LDAP authentication with VB.NET
Tags:LDAP, or Lightweight Directory Access Protocol, is a convenient, central repository for a system's personnel information. LDAP (and other Active Directory services) are widely-used by organizations big and small to consolidate user …
Simple MD5 hashes in VB.NET
Tags:MD5 (Message Digest) hashes are a simple, efficient way to encode/encrypt information to be passed around. Rather than containing the data itself, an MD5 hash is merely a fingerprint of the information. The hash cannot be decrypted, but …
Using the ConnectionStrings element in ASP.NET web.config
Tags:If you are building a series of web applications that may rely on duplicate data (such as connection strings for pages that query databases), or you want to separate certain constants from your other code, you need a centralized method …
Prepared SQL statements in VB.NET
Tags:Thousands of websites have been hit lately by the rash of SQL injections being perpetrated en-masse. Most languages (current versions, at least) have a procedure for separating parameters from the query they augment in an effort to …