Home » ASP.net | SEO

When ASP.net, Url re-writing and search engines do not play nicely

28. March 2009 by Dave Hawes 0 Comments

I have been using Url re-writing on my new website www.trainingcoursebooker.com to try and make friendly, human readable urls which are good for both people and search engines. There is a very subtle problem which I finally found and more importantly found a solution to.

Everything works great in testing and in live. However my email inbox was suddenly filled with notifications of errors on the site (I’ve written code that notifies me of all errors via email so I don’t have to check event logs). The important part of the exception message is:

Message: Cannot use a leading .. to exit above the top directory.

After a google around most of the answers seemed to be in the fact I would be using some kind of ../../../ notation to reference a stylesheet or something. After going through all my code multiple times I was sure it wasn’t that. I could not reproduce the errors and was very puzzled.

It then occurred to me that it might not be a user browsing the site triggering this but a search engine crawling it. Sure enough with another google around I found this great article which found out that the browsers search engine crawlers use are not recognised by ASP.net and so my application was assuming that cookies are not supported which in turn causes this problem – for the full explanation please read the original article:


I plumbed for creating a browser file to tell my application that the search engine browsers do support cookies which has fixed the problem and I haven’t received an error notification since :D

Comments are closed