Friday, January 9, 2009

Returning a relative path

Returning a relative path to the current page on your asp.net site is in some occasions better to use then having a static path. There are two ways to do this in asp.net. One is to use ResolveClientURL and another to use ResolveURL. The difference between these two is that ResolveClientURL returns a path relative to the current aspx page, while ResolveURL returns a path relative to your internet site root.

Below is an example showing four links, the first one is a static link, the second actually fails as a link, and the last two links shows how to use ResolveClientURL and ResolveURL:


No comments:

Post a Comment

get a counter