Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created March 24, 2014 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/9751090 to your computer and use it in GitHub Desktop.
Save bennadel/9751090 to your computer and use it in GitHub Desktop.
Turning Off Session Management for Web Spiders
// Define the application. To stop unnescessary memory usage, we are going to give
// web crawler no session management. This way, they don't have to worry about cookie
// acceptance and object persistance (except for APPLICATION scope).
if ((NOT Len(CGI.http_user_agent)) OR REFindNoCase("Slurp|Googlebot|BecomeBot|msnbot|Mediapartners-Google|ZyBorg|RufusBot|EMonitor|researchbot|IP2MapBot|GigaBot|Jeeves|Exabot|SBIder|findlinks|YahooSeeker|MMCrawler|MJ12bot|OutfoxBot|jBrowser|ZiggsBot|Java|PMAFind|Blogbeat|TurnitinBot|ConveraCrawler|Ocelli|ColdFusion", CGI.http_user_agent)){
// This application definition is for robots that do NOT need sessions.
THIS.Name = "KinkySolutions v.1 {dev}";
THIS.SessionManagement = false;
THIS.SetClientCookies = false;
THIS.ClientManagement = false;
THIS.SetDomainCookies = false;
// Set the flag for session use.
REQUEST.HasSessionScope = false;
} else {
// This application is for the standard user.
THIS.Name = "KinkySolutions v.1 {dev}";
THIS.SessionManagement = true;
THIS.SetClientCookies = true;
THIS.SessionTimeout = CreateTimeSpan(0, 0, 20, 0);
THIS.LoginStorage = "SESSION";
// Set the flag for session use.
REQUEST.HasSessionScope = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment