ImageInfo.File doesn’t support the root operator (~) like native .NET classes do. Will this be corrected in the future?
From
http://msdn.microsoft.com/en-us/library/ms178116.aspx
Absolute and relative path references in a server control have the following disadvantages:
- Absolute paths are not portable between applications. If you move the application that the absolute path points to, the links will break.
- Relative paths in the style of client elements can be difficult to maintain if you move resources or pages to different folders.
To overcome these disadvantages, ASP.NET includes the Web application root operator (~), which you can use when specifying a path in server controls. ASP.NET resolves the ~ operator to the root of the current application. You can use the ~ operator in conjunction with folders to specify a path that is based on the current root.
The following example shows the ~ operator used to specify a root-relative path for an image when using the Image server control In this example, the image file is read from the Images folder that is located directly under the root of the Web application, regardless of where in the Web site the page is located.
You can use the ~ operator in any path-related property in server controls. The ~ operator is recognized only for server controls and in server code. You cannot use the ~ operator for client elements.