Archives for June 2009

Fast and Efficient C# and Visual Basic String Concatenation

If you do any sort of web development work on the .NET platform, you are going to find yourself concatenating (connecting) strings together on a very regular basis. There are two ways to do this. The first is with a traditional string concatenation, which would look something like this: string MyString = String.Empty; MyString = "Hello " + … [Read more...]

ASP.NET Performance Tip: Remove Unnecessary Library References

Over the last few days, I've been scouring the web for techniques and strategies to optimize ASP.NET code so that it runs faster and more efficient, resulting in quicker load times. A lot of what I found was pretty standard advice, disable viewstate, use the StringBuilder for concatenation, disable tracing and use AJAX. One piece of advice that I … [Read more...]

How to Display Your Twitter Feed using ASP.NET

UPDATE 3/23/2010 - Ricky from Twitterizer commented below noting that basic authentication will soon go away via Twitter and OAUTH will be required. Note that the code below will only work for a few months. We will post an updated code-example soon. As I write this article, It's about 75 degrees and Sunny outside. When I should be going out on a … [Read more...]

How to Implement an ASP.NET Color Picker

One of the components of the 360 Web Content Management System (website in progress) that I wanted to develop was an events calendar that allowed you to post events into color-coded categories. You can see a demo of it here. At first, I had it so that users would manually enter in a 6-character HTML color code, but it was very non-intuitive for … [Read more...]

How to Validate Email Addresses in C#

I was recently doing doing support for a client that had a newsletter system. The previous employee had neglected to do much in the form of format validation for email addresses from both a user-input standpoint and system-integrity standpoint. Since there were several email addresses in the database that didn't meet the basic conventions of an … [Read more...]

Create a Sortable HTML Table with JQuery and TableSorter

One of the more useful features of ASP.NET's GridView control is that users can sort the information in the table they are seeing by any number of fields. To allow this sorting to happen, ASP.NET sends a post-back to the server and the web server re-renders the page with the GridView re-sorted in the order requested. Now, there's a way to display a … [Read more...]

How to Validate Forms with JQuery

Just about everyone who's ever made a web-application knows that you generally can't trust your users to enter data correctly into a form. Some of them will ignore important fields, others will type in data that couldn't possibly be right. Some will try to choose two character passwords and others will enter in a long string of text when all you … [Read more...]

Hash Passwords in C# and Visual Basic Using SHA-512

We recently covered an easy way to hash passwords using SHA-1┬áin .NET using either Visual Basic or C#. In most cases, SHA-1 encryption is "secure enough", but there are some mathematical weaknesses. Microsoft's .NET platform (specifically the System.Security class) allows you to encrypt passwords with a number of differnet algorithms without having … [Read more...]

How to Authenticate a User in Active Directory using ASP.NET

If you're working in an academic or large corporate or government setting, changes are you're going to have a network in place using Active Directory or an open-source equivalent. Every user in the organization will have some sort of an account to use. If you're building an internal web-application or desktop-application, it doesn't make a lot of … [Read more...]

How to Resize Photos in ASP.NET

If you're developing a website that allows users to upload any sort of photos or images, you have to expect that they aren't going to bother doing any sort of basic image manipulation, such as resizing an 8 megapixel image down to something that's appropriate for the web. Fortunately, there are a number of good cropping and image resizing tools … [Read more...]