Home » ASP.net | SEO

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

28. March 2009 by Dave Hawes 5 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:

http://weblogs.asp.net/dfindley/archive/2006/09/05/Problems-with-RewritePath-and-Search-Engines_2E00_.aspx

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

Women's Handbags
United States Women's Handbags said:

To solve the ../../../ issue, use the absolute path instead of using the relative path to specify the css.

<link rel="Stylesheet" type="text/css" media="Screen" href="../../style.css" />

it's better:
<link rel="Stylesheet" type="text/css" media="Screen" href="http://domain.com/style.css" />

davehawes
United Kingdom davehawes said:

Thanks for the comment - however this particualr problem is not to do with paths to CSS files, using ../../../ notation. I was already using absolute paths as you suggested but was getting this error.

This is a specific problem with ASP.net, search engine crawlers and url rewriting.

davehawes
United Kingdom davehawes said:

Hi Matthew,

I really like Blogengine as it is written in c# which is my language of choice. This makes ammendments to it much easier for me as it complements my skills. If you are a php developer then I would suggest sticking with wordpress.

As for the themes for blog engine I would have to say that they are much easier to create than those for word press. The main reason for this is the power of the asp.net master page. This makes life a lot easier in designing the theme as it is basically creating a webpage with a content holder in it. I have asked my graphic designer to look at doing some skins for word press and it looks very fiddly in comparison. There are multiple php files you have to edit and include which reminds me of my classic asp days. It works but it requires a higher level of technical understanding in my opinion.

Again if you are competant with wordpress then it might be worth sticking with that. There is massive community support for it with lots of cool contributions. However it is php development which is something I am not skilled in.

I hope my 2pence worth is useful to you!

r4 ds
United States r4 ds said:

Excellent article.As for the themes for blog engine I would have to say that they are much easier to create than those for word press. The main reason for this is the power of the asp.net master page.

pingback
endyear2012.com said:

Pingback from endyear2012.com

car insurance cheap quote «  End Year 2012

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading