Get your Google search position in C#

Jan 31, 2007
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 find the position like the method shows below. You can use the code to build a cool application that lists the positions of your website based on all your important search terms. You can change it to run asynchronously for better performance when checkin... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Stock quote class in C#

Jan 30, 2007
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 some free services that could provide the data in XML format or something similar that can be easy parsed. Apparently that does not exist. All the stock sites charge you for that information and I want something free, so that was not the way to go. The... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Universal data type checker

Jan 30, 2007
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 IsNumeric and IsDate functions, but that's about it. You are left to your own data type checking logic the rest of the time. It would be cool if we could have a method that could check all data types that is represented by strings such as integers, guids,... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Working with query strings

Jan 27, 2007
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. It could look like this: if (Request.QueryString["id"] != null) {   // Do something with the querystring } The only problem with the above check to see if the query string is null, is that ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Access client information server-side

Jan 25, 2007
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 provide very little information about the visitors platform, and that’s about it. If they also provided screen resolution and available browser window real estate, it would start being useful for other scenarios than we are used to. Then I started thinking about a way to provi... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

The death of the ArrayList

Jan 25, 2007
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 well. It was kind of the do-it-all solution for the lazy developer that just needed things to work the first time. Along came the .NET Framework 2.0 which introduced Generics to the platform. Since the first beta of Visual Studio “Whidbey” was released more ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

HttpModule for query string encryption

Jan 25, 2007
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 hacker could do with it. Security or not, sometimes you just don’t want the visitors to see all the query strings for whatever reason. In those cases it would be nice if we could encrypt the entire query string so it wouldn’t carry any readable information. The problem wi... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Do postbacks with parameters in JavaScript

Jan 23, 2007
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 property to true. It all works very much the same way from a user’s point of view - click or select and the page performs a postback. However, in some cases you want to be able to do a postback from a custom JavaScript function that emulates the click of an ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Keep the content-type in sync

Jan 22, 2007
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 also adds the content-type to the HTTP headers of the response by default and to avoid surprises you should make sure the header and meta-tag inform the browser about the same content-type. You can specify the content-type on individua... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

The what, why and how of XML code comments

Jan 21, 2007
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 commenting code is not how you do it, but what you write in them. Methods are the most challenging members to comment, because they perform an action and can contain many lines of code compared to e.g. properties. Because of their relative complexity ... [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.