Productivity tips, reviews, tools, software and gadgets.

FIX: GoogleBot produces "Cannot use a leading .. to exit above the top directory" in ASP.NET

I found numerous "Cannot use a leading .. to exit above the top directory" errors in my Elmah-logs lately, all of them generated by the ASP.NET engine after a visit from GoogleBot. It is caused by using URL rewriting in your aspx-pages in order to have more readable URL's and better search engine rankings.

Funnily, this only started after I submitted dynamically generated sitemaps to the Google Webmaster Tools for my clients websites. Instead of improved ranking and indexing, however it resulted in exclusion of all failing URL's.

For more background information about this error, which is generated only for certain user agents including GoogleBot and Yahoo! Slurp, you can do a simple Google search. There are a few solutions to fix this, but most involve using a custom base page class or creating different .browser files for each problematic user-agent in the App_Browser directory. Having done custom browser.ini solutions with Browserhawk years ago, I did not feel like starting all over again with googlebot.browser, yahooslurp.browser etc.

By far the easiest solution is a simple change in your web.config:
Find the <authentication> section, then change the <forms> line by adding:


Voila, the problem is fixed. Note that this disables cookieless functionality for forms, so if you really need that you should use a different solution.

Labels: , , , , , , , , , ,

  Posted by oVan on Sunday, April 06, 2008 | PermaLink | 0 comments
« SuperWasp start page