Little Helper – a true Web 2.0 application

Sep 28, 2006
Little Helper, the interactive help system for Headlight is now live and almost finished. It is build much like a Wiki so Headlight users can contribute and ask questions. I like to call it a good mix of a blog and an article base, because it works like a blog but without the chronology. The whole thing will be available for free download sometime in the near future. The vision We envisioned a community driven help system where people actively participated to c... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Wildcard search for domains in C#

Sep 27, 2006
At work, we had to do wildcard searches using regular expressions to match allowed domain names. For instance, this expression “*.madskristensen.dk” should match “www.madskristensen.dk”. So, my boss Jimmi wrote a method that he allowed me to post here. Here are some examples on how to use it: IsDomainValid( "www.madskristensen.dk" , "*.madskristensen" ); is true IsDomainValid( "www.madskristensen.dk" , ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Convert a date to the RFC822 standard for use in RSS feeds

Sep 27, 2006
Today I wrote a new dynamic RSS feed for a little project called Little Helper. It all works fine, but when I tried to validate it using FeedValidator, the pubDate was invalid. The validator told me that the date was not proper formatted using the RFC822 standard which looks something like this: Wed, 27 Sep 2006 21:36:45 +0200. Ok, that’s no problem right? Just format the DateTime correctly and you’re ready to go. Wrong! This is what happens if y... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Firefox and IE read file names differently

Sep 24, 2006
In a recent web project I suddenly got an unexpected exception when I was uploading a file using a standard <asp:FileUpload /> control in ASP.NET 2.0. I’ve only been testing the website in Firefox at that point and everything worked great. The error only occurred in IE 6 and 7. Here is a little dummy code that I’ll use to demonstrate the difference. <asp:FileUpload runat="server" ID="txtUpload" />   pri... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Retrieve the subdomain from a URL in C#

Sep 20, 2006
Yesterday I had to come up with a method that retrieved the subdomain from the current web request on an ASP.NET website. I thought that the System.Uri class contained that information in an easy retrievable way, but no.  Here’s what I came up with instead. It still uses the System.Uri to find the subdomain. /// <summary> /// Retrieves the subdomain from the specified URL. /// </summary> /// <param name="... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Find the number of string occurrences in another string

Sep 19, 2006
In C# 2.0 Microsoft introduces some new methods on the String class, one of them being Contains. The Contains method checks if a string in contained within another string in a case-sensitive way. It is very easy to use and a good addition to the String class. However, often you don’t want a case-sensitive search or you want to know how many times a particular string is contained within another.  Because the String class doesn’t provide us with such methods, we ha... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Keep security as simple as possible

Sep 18, 2006
When building a new application, be it Windows Form or ASP.NET, security is an important factor to consider from the very beginning. There are hundreds of books and thousands of websites helping you to secure your application, but they all seem to share one annoying thing; they make security solutions too complex. Security is a complex issue to address and that usually requires complex solutions so what is the problem?The problem In the myriads of applications out the... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Validate strong passwords in C# and ASP.NET

Sep 17, 2006
It’s always a good idea to have a password policy when creating new applications. A password policy can vary from project to project, but the important part is just to have one to begin with. It is very difficult to implement later in the process and then change all the users’ passwords accordingly. You can do a lot of things to enforce strong passwords, but the most versatile one is probably using regular expressions. This regular expression will enforce a passw... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Clean up your music library and other folders

Sep 13, 2006
I have a normal sized MP3 collection on my computer and I let Windows Media Player take care of arranging the MP3 and WMA files in the folders based on the media information in the ID3 tags. In my music folder, there is a folder per artist, and in each of them there is a folder per album which then contains the actual MP3 or WMA files. That adds up to a great number of folders. When I delete a song from within Windows Media Player, the file is deleted from disk but th... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Update: Stronger password encryption

Sep 12, 2006
Yesterday, I wrote how to encrypt a password using a one-way MD5 hash, but as some of the comments point out, the MD5 algorithm is not strong enough. I listened and wrote a new encryption method that uses SHA256 instead of MD5. public string Encrypt(string plainMessage) {   byte[] data = Encoding.UTF8.GetBytes(plainMessage);   using (HashAlgorithm sha = new SHA256Managed())   {   ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.