getting the value from ~ at run time

  • Thread starter Thread starter neverstill
  • Start date Start date
N

neverstill

Hi-

I am creating a series of images in a datalist, I want to have rollovers on
them, so I am also spitting out some client side script via a Literal.
I have hit a hitch. I make extensive use of the '~' character to get to the
virtual root. I have nested controls so when I need to get to the images
folder, I use "~/Images"

If I try to use the ~ in a literal, I will of course get "~" rather than
http://localhost/rootName
so, how can I accomplish this? I noticed that the Request class has some
members, namely the Uri, but I don't have access to that apparently.

As a hack I'm using preprocessor code to return the root like this:
#if DEBUG // assumed to be dev machine if running debug
return http://localhost/rootName;
#else
return http://www.ProductionServerName;
#endif

This is ugly and still prone to error. There must be a better way.

Any ideas?


Also, does anyone know of any code samples where you can see a good
implementation of image based navigation using a DataList? For example, an
ArrayList of navigation data structs pumped into a DataList, but instead of
using text for the labels, using images AND having DHTML?? It is proving to
be a little more difficult than I expected.

Any help appreciated.

Thanks,
Steve
 
yeah, that works it looks like. I also found Request.ApplicationPath() will
do the same it appears.
Thanks for the help!
 
Back
Top