January 2007
23 articles published in January 2007
-
Get your Google search position in C#
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...
-
Stock quote class in C#
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...
-
Universal data type checker
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...
-
Working with query strings
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...
-
Access client information server-side
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...
-
The death of the ArrayList
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...
-
HttpModule for query string encryption
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...
-
Do postbacks with parameters in JavaScript
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...
-
Keep the content-type in sync
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...
-
The what, why and how of XML code comments
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...
-
The example domain
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...
-
Choose a standard number format
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...
-
Get the query string right
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 "?"...
-
The class you didn’t know existed
…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...
-
Block DoS attacks easily in ASP.NET
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...
-
Use the thread pool in ASP.NET
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...
-
TraceWorks is hiring
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...
-
Block IP addresses from your website
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...
-
Catch the right closing event
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...
-
Website monitoring tool
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...
-
Parse controls dynamically in ASP.NET
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...
-
The Create GUID menu item is back
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 –...
-
Use JavaScript to cancel Adobe Flash requests
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...