Archive for the ‘ASP.Net’ Category

ASP.Net Detecting Bots, Crawlers

Sunday, October 25th, 2009

This article discusses a method to detect bot and crawler visits to your site.

Recently, I was developing a model to collect visitor information to the site. The stats showed a mind boggling 10,000 visits a day. Stunned! This was highly unlikely for us. I tracked this through Google Analytics which showed a different number i.e. 2000. Well, we all are aware of the difference in script based (Google analytics) and server log based tracking arguments. I was experiencing the same. Reading through and understanding the concept, I got very suspicious on spider and crawler visits. Well, so the journey started to find out the and categorize the bot/crawler visits.
(more…)

Moving out of an IFrame

Sunday, April 19th, 2009

The following code snippet demonstrates the redirection from an IFrame to a webpage.

Many a times we need to redirect from within a IFrame to a webpage. We can achieve this by using javascript.
(more…)

IIS7 Executing Directory

Monday, October 27th, 2008

Generally we get the executing directory path using the HttpContext.Request.PhysicalPath etc. In IIS7 this won’t work. We cannot access the HttpContext.Request object in Global.ascx.
This is the way to do this,

int binPos = HttpRuntime.BinDirectory.LastIndexOf("\\bin");
string executingDirectory = HttpRuntime.BinDirectory.Remove(binPos);

Have fun.

Get user IP address

Thursday, September 25th, 2008

Well, yes, it looks like trivial but it isn’t. Many a times we need to get the IP address of the user. There are a handful of suggestions to do this. I discuss the methods and the short comings in them.
(more…)