January 2007

23 articles published in January 2007

  1. Get your Google search position in C#

    · 2 min read

    If you want to test your position in Google for a certain search term, you can do so by using the Google website. By position I don't mean Page Rank, but the actual place in the search results. You can also use C# to...

  2. Stock quote class in C#

    · 2 min read

    A couple of months ago one of my readers asked me to build a stock quote class that would automatically update the quote. I forgot about it, but then I found the e-mail and decided to give it a go. I started looking for...

  3. Universal data type checker

    · 2 min read

    In many different scenarios we need to check if a string can be converted into an integer e.g. This could be when we work with query strings and need to check if they match a certain data type. In VB.NET you can use the...

  4. Working with query strings

    · 1 min read

    In many cases we write our ASP.NET logic around query strings in order to show the right product page or what not. The first thing we do is to check if the query string exists in the first place before we start using it...

  5. Access client information server-side

    · 3 min read

    Today, I was playing around with HTTP request headers and for some reason started thinking about how limited information they provide about the requesting browser. All they really provide is the user agent string which...

  6. The death of the ArrayList

    · 1 min read

    In the good old .NET 1.x days where Generics wasn’t born yet, the ArrayList was the class to use for just about any type of collection. It was much easier to use compared to an array of objects and it did the job very...

  7. HttpModule for query string encryption

    · 2 min read

    URL parameters or query strings are often used to carry information that can be used by hackers to do identity theft or other unpleasant things. Consider the URL example.com/?user=123&account=456 and then imaging what a...

  8. Do postbacks with parameters in JavaScript

    · 2 min read

    Whenever you use a Button or LinkButton it is because you want to be able to do a postback when it is clicked. The same could be the case for CheckBox or DropDownList etc. but then you need to set the AutoPostback...

  9. Keep the content-type in sync

    · 1 min read

    Most websites include a meta-tag that tells the browser what content-type the document is. It looks like this: < meta http-equiv ="Content-Type" content ="text/html; charset=iso-8859-1" />> All ASP.NET web applications...

  10. The what, why and how of XML code comments

    · 3 min read

    During the years I’ve seen a lot of different ways of commenting code – some good and some bad. My personal favourite way of commenting code is by using the XML comment feature of C# and VB.NET, but the important part of...

  11. The example domain

    · 1 min read

    I always use google.com in my code samples as a way to show an example domain or URL. That’s because I wasn’t aware that there is a dedicated domain for use in samples which is'n available for registration. Check out...

  12. Choose a standard number format

    · 2 min read

    Today, I ran into an issue regarding the way numbers are parsed in different cultures, which resulted in very wrong numbers. The problem begins when your web application is set to automatically resolve the culture...

  13. Get the query string right

    · 2 min read

    Today, I ran into a strange little issue regarding the System.Uri class that took me too long to figure out. The Uri class has a property called Query that, according to the documentation, returns everything from the "?"...

  14. The class you didn’t know existed

    · 1 min read

    …Or at least a class I didn’t know existed, but let’s see if I’m right or not. The class resides in the System.Web.UI namespace and is used various places in ASP.NET. Among those places are the inner workings of the...

  15. Block DoS attacks easily in ASP.NET

    · 2 min read

    Denial of Service (DoS) attacks are becoming a more and more common way to bring websites and servers down. They are very easy to do and pretty hard to protect against, which is why they are so popular. The only thing...

  16. Use the thread pool in ASP.NET

    · 1 min read

    The thread pool gives you an easy and safe way for creating multithreaded applications, and even though the stateless nature of the Internet isn’t the best place for multithreading, it can still be the right thing to do...

  17. TraceWorks is hiring

    · 1 min read

    This is great news for all .NET developers who want a job in Copenhagen, Denmark. We need to find a Senior C# Back-end Developer and a ASP.NET Front-end Developer. Both positions are highly technical and very interesting...

  18. Block IP addresses from your website

    · 1 min read

    Recently, one of my readers asked me how to block certain IP addresses from accessing his ASP.NET website. It was a good question that could be answered in multiple correct ways. My answer was a plug ‘n play HttpModule...

  19. Catch the right closing event

    · 1 min read

    Whenever a Windows Form is closed, you can catch this event by overriding the OnClosing() method. In this method you have the option to do some cleanup before it closes. You can also prevent the Form from closing by...

  20. Website monitoring tool

    · 2 min read

    For quite a while now, I have needed a simple website monitoring tool that would check the uptime of my websites. There are a lot of different ones on the Internet, some are free and some are very expensive. All the ones...

  21. Parse controls dynamically in ASP.NET

    · 2 min read

    Most of the primitive types in the CLR have a Parse method that takes a string and parses it into its own data type. I could be DateTime.Parse(string) or Int.Parse(string) etc. It’s a great way of doing late binding and...

  22. The Create GUID menu item is back

    · 2 min read

    The Visual Studio 2005 launch improved so many things from older versions – some big and some small. Yet somehow it is always the small things you remember. The 2005 release is superior in almost any aspect except one –...

  23. Use JavaScript to cancel Adobe Flash requests

    · 2 min read

    Internet Explorer can only make 2 connections at a time, which means that only two elements can be loaded while the rest is queued up. Imaging a web page with 10 Flash movies, then only two of the movies can be loaded at...