P
Paul Hatcher
Sorry to post this again - I didn't use my MSDN alias previously...
I'm using a url rewriting mechanism to make my site's urls more
search-engine/user-friendly, so we have http://www.mysite.com/links/1023.apx
which is actually internally mapped to
http://www.mysite.com/links.aspx?link=1023. This works fine and makes the
site look a lot cleaner.
The problem I'm having is with controls on the target page. I render all the
urls as root relative so that I'm independent of whether I'm a root web or
an application, so we have ~/images/img1.jpg for images and and
~/links/4096.aspx as a child link of 1023 for example.
The problem is that the ASP.NET controls convert my relative paths to
images/img1.jpg and links/4096.aspx, when evaluated these become
http://www.mysite.com/links/images/img1.jpg and
http://www.mysite.com/links/links/4096.aspx which of course don't exist.
Now interestingly, if I call ResolveUrl in the page on say ~/images/img1.jpg
I correctly get /images/img1.jpg. There's basically a different behaviour
between ResolveUrl and Control.ResolveUrl.
I have a workaround, which is to make everything an absolute path, but it's
not very satisfactory since it makes demoing stuff to clients a pain - you
have to have a root web available rather than just creating an application
directory somewhere.
I'd call this a bug, since there should only be one implementation of
something like ResolveUrl.
Anyone else found this and have a better workaround?
Paul
I'm using a url rewriting mechanism to make my site's urls more
search-engine/user-friendly, so we have http://www.mysite.com/links/1023.apx
which is actually internally mapped to
http://www.mysite.com/links.aspx?link=1023. This works fine and makes the
site look a lot cleaner.
The problem I'm having is with controls on the target page. I render all the
urls as root relative so that I'm independent of whether I'm a root web or
an application, so we have ~/images/img1.jpg for images and and
~/links/4096.aspx as a child link of 1023 for example.
The problem is that the ASP.NET controls convert my relative paths to
images/img1.jpg and links/4096.aspx, when evaluated these become
http://www.mysite.com/links/images/img1.jpg and
http://www.mysite.com/links/links/4096.aspx which of course don't exist.
Now interestingly, if I call ResolveUrl in the page on say ~/images/img1.jpg
I correctly get /images/img1.jpg. There's basically a different behaviour
between ResolveUrl and Control.ResolveUrl.
I have a workaround, which is to make everything an absolute path, but it's
not very satisfactory since it makes demoing stuff to clients a pain - you
have to have a root web available rather than just creating an application
directory somewhere.
I'd call this a bug, since there should only be one implementation of
something like ResolveUrl.
Anyone else found this and have a better workaround?
Paul