Getting an Alexa Rank programmatically in C#

As part of a project I’m working on, I needed to lookup the Alexa Traffic Rank for a domain programmatically. I found the URL the toolbar uses and wrote function to parse the XML and return the value, which I thought I’d share in case it saves someone else 15 minutes of their life… private int GetAlexaRank(string domain) { var alexaRank = 0; try { var url = string.Format("http://data.alexa.com/data?cli=10&dat=snbamz&url={0}", domain); var doc = XDocument.Load(url);…

Read More

Redirecting www.* subdomain to the root domain in IIS 7

Having your site available on www.yourdomain.com and yourdomain.com isn’t good for your SEO as it splits the domain authority. You can use the Google Webmaster Tools to specify which domain Google should use, but you should also redirect on the site itself. You can do this in your web.config directly, but IIS has a module to do it for you. Redirecting from a sub-domain in IIS 7 is really easy using the URL Rewrite feature. First select the URL Rewrite module for your domain: Click Add Rul…

Read More