Programming SEO – Ping
Now that we have an RSS feed we can use the feed to ping the various RSS directories that are available on the Internet. This will create links back to your site including links back to your inner pages, which are the best links you can get.
You also get the advantage of people searching for information on those sites, finding a link to your site, and eventually coming to your site.
Once again, there is code that has already been written about pinging from ASP.NET. So I’m not going to bother republishing that content. Here are some links you might be interested in looking at for the code:
- Ping using XML-RPC in ASP.NET
- Ping WebLogs.com Using XML-RPC and VB.NET
- XML-RPC ping endpoint in C# and ASP.NET
- How to Send Trackback and Pingback Requests in ASP.NET
Once you have your basic ping code set up, you’ll need to have your code fire it off. As mentioned in one of the articles above, you’ll want to make sure you do this in a multi-threaded way. But you’ll also want to make sure that you don’t ping too often, or you can get your site banned by some of the directories you are trying to notify.
In the code that I implemented, the articles have a time stamp for when they will be published. So all I need to do in my code is see if there is an article that has been published since the last time I sent out the ping and send out a new ping if there is.
The site I implemented this on is on a web farm, which made the code a little more complicated than yours might need to be, but here’s what I wrote.
try { if (Cache["rssDate"] == null) Cache["rssDate"] = Controller.GetRSS()[0].Launch_Date; if (Cache["lastRssDate"] == null) Cache.Add("lastRssDate", Controller.GetLastRssDate(), null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(12, 0, 0), System.Web.Caching.CacheItemPriority.Normal, null); DateTime lastRssDate = (DateTime)(Cache["lastRssDate"]); DateTime mostRecentRssDate = (DateTime)(Cache["rssDate"]); if (Request.Url.Host.ToLower() .Contains("www.domain.com") && mostRecentRssDate > lastRssDate) { // double check because we are on a // farm and don't want to ping twice Cache["rssDate"] = Controller.GetRSS()[0].Launch_Date; Cache.Add("lastRssDate", Controller.GetLastRssDate(), null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(12, 0, 0), System.Web.Caching.CacheItemPriority.Normal, null); lastRssDate = (DateTime)(Cache["lastRssDate"]); mostRecentRssDate = (DateTime)(Cache["rssDate"]); if (mostRecentRssDate > lastRssDate) { Controller.SetLastRssDate(mostRecentRssDate); Cache["rssDate"] = mostRecentRssDate; Pinger.DoPings("Site Title", "http://www.domain.com/RSS.ashx"); } } } catch (Exception) { }
Notice that I’m using the Cache object to store the last date so that I don’t have to retrieve it from the database, but I am storing the information in the database so that I can retrieve it from the other server(s). rssDate stores the most recent date from the RSS feed and lastRssDate stores the last time the ping was sent out.
I placed this code in the Page_Load event handler of the master page of my site so that it would fire whenever a page on the site was accessed. Since the site I placed this on gets over 1000 visitors a day, I figured this was sufficient.
Other Related Items:
Bruce Lee Ultimate Collection (The Big Boss / Fist of Fury / Way of the Dragon / Game of Death / Game of Death II)No Description Available.Genre: Feature Film-Action/Adventure
Rating: UN
Release Date: 18-OCT-2005
Media Type: DVD
Phiten Star Necklace, Red, 22"This is the hottest item in Professional sports medicine today! Over 300 athletes currently wear this product in competitions! Liberate yourself from ... Read More >
Beer Pong Balls - 144/pkThis listing is for a box of 144 brand new white ping pong balls. These balls can be used for ping pong, table tennis, beer pong, beirut, carnival gam... Read More >










[...] Programming SEO – Ping (Dave) [...]
[...] Programming SEO – Ping (Dave) [...]