Archive for December, 2007

December 28th, 2007

R.I.P. Netscape Browser 1994 - Feb 2008

It has been a long time coming, but AOL has decided to retire the once unstoppable Netscape Browser, think 1998. Netscape has had a long and good life, and is survived by it’s sibling Firefox.

In the process of AOL trying to reinvent it self as a media company some less than successful projects needed to be axed as explained in a Netscape Blog Post:

AOL’s focus on transitioning to an ad-supported web business leaves little room for the size of investment needed to get the Netscape browser to a point many of its fans expect it to be. Given AOL’s current business focus and the success the Mozilla Foundation has had in developing critically-acclaimed products, we feel it’s the right time to end development of Netscape branded browsers, hand the reigns fully to Mozilla and encourage Netscape users to adopt Firefox.

Rest In Peace my first browser you had a longer life than most software projects, and in the past years you have been hobbling along in your walker. You have led a good life. We solute you.

Tags: , , , , ,

Posted in Programming | kick it on DotNetKicks.com | Bookmark | View blog reactions | No Comments »

December 22nd, 2007

Merry Christmas and Happy Holidays To All

My wife and I would like to say Merry Christmas to all of the daily readers that have made this blog so successful over the past year.

Tags: ,

Posted in Personal | kick it on DotNetKicks.com | Bookmark | View blog reactions | No Comments »

December 7th, 2007

SEO and C# Extention Methods

I previously talked about the importance of using the correct kind of redirect to optimize your website for search engines in an article titled. World Of HTTP/1.1 Status Codes. I just recently decided to create a C# Utility class to help me in this endeavor and to extended the far from complete HttpResponse.Redirect method. I am using a new C# 3.0 language extension called Extension Methods. Basically what the extension method does is, it allows you to, add methods to types that you don’t have the ability to modify, in my case the HttpResponse class.

I have created the following code to give me better control over my redirects in the HttpResponse class.

public static void Redirect(this HttpResponse response, int type, string url)
{
	response.Clear();

	switch (type)
	{
		case 301:
			response.StatusCode = (int)HttpStatusCode.MovedPermanently;
			response.StatusDescription = "Moved Permanently";
			break;

		case 302:
			response.StatusCode = (int)HttpStatusCode.Found;
			response.StatusDescription = "Found";
			break;

		case 303:
			response.StatusCode = (int)HttpStatusCode.SeeOther;
			response.StatusDescription = "See Other";
			break;

		case 304:
			response.StatusCode = (int)HttpStatusCode.NotModified;
			response.StatusDescription = "Not Modified";
			break;

		case 307:
			response.StatusCode = (int)HttpStatusCode.TemporaryRedirect;
			response.StatusDescription = "Temporary Redirect";
			break;

		default:
			goto case 302;
	}

	response.RedirectLocation = url;

	response.ContentType = "text/html";
	response.Write("<html><head><title>Object Moved</title></head><body>");
	response.Write("<h2>Object moved to <a href=\"" + HttpUtility.HtmlAttributeEncode(url) + "\">here</a>.</h2>");
	response.Write("</body></html>");

	response.End();
}

So now in your code you don’t have to jump through hoops to chance the StatusCode, StatusDescription, RedirectLocation, and ContentType, just so you can respond with a 301 Redirect instead of a 302 Redirect (the default for HttpResponse.Redirect and the most dangerous of the redirects from an SEO point of view). All that you need to have access to is the Response property from your Page or Context and you are good to go.

Response.Redirect(301, "http://www.coderjournal.com");

So that is all you need to do to give your self better control over your redirects in .NET. You can also use this same C# 3.0 Extension Methods for any object that you need to add a custom method on to.

Tags: ,

Posted in C#, Programming, SEO | kick it on DotNetKicks.com | Bookmark | View blog reactions | 4 Comments »