log in

ASP.NET Gotcha: cookieless and url rewriting

Luke Breuer
2008-02-06 17:02 UTC

Let's say URL rewriting is being used and the paths are as below; an attempt to get cookieless URLs will cause an exception complaining about there being too many "../"

With use of Reflector, I found that the bug occurs at the MakeRelative call below; the two values are sample values that will result in an exception when the client is in cookieless mode (GoogleBot and Yahoo Slurp! both operate in cookieless mode).
virtualPathString = clientFilePath.MakeRelative(currentExecutionFilePathObject).VirtualPathString;

ClientFilePath                 = /item/Command_line_questions/97.aspx
CurrentExecutionFilePathObject = /item.aspx