how to convert "~/xxx" to AbsoluteUri ?

  • Thread starter Thread starter jiatiejun
  • Start date Start date
The method is found inside images controls, and the like. If you need to
dupe this, I would grab Reflector and "reverse engineer" the bits in
question so you can get the methodology down. This will solve the ~. You
will have to add the rest.

If you want to trudge through this, it is a matter of pulling the URL for
the site and getting the root portion and adding the rest of of the image
path.

I am not sure you really want to create a convert that accepts any sort of
garbage, like 'xxx/xxx.gif', but your mileage may vary. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
 
Cowboy (Gregory A. Beamer) said:
The method is found inside images controls, and the like. If you need to
dupe this, I would grab Reflector and "reverse engineer" the bits in
question so you can get the methodology down. This will solve the ~. You
will have to add the rest.

If you want to trudge through this, it is a matter of pulling the URL for
the site and getting the root portion and adding the rest of of the image
path.

I am not sure you really want to create a convert that accepts any sort of
garbage, like 'xxx/xxx.gif', but your mileage may vary. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

How is 'xxx/xxx.gif' garbage? It is just stating that the file 'xxx.gif'
is located in the 'xxx' sub-directory of the current directory. Also, if
you are doing this in a web control, or web page, you can use the ResolveURL
method which will take care of the tilde '~' and the rest to resolve the URL
into the full URL....(I believe it is a protected method on the Control
class, IIRC).

HTH,
Mythran
 
Garbage is probably improper wording.

Most likely, you are providing this functionality for developers. If so, why
do they need many different formats that they can put a dynamic string into?
The more you support, the more likely you are going to have errors.

If for users, you can format the string when it comes in. And, then you only
need to support one format.

One thing we developers often do is make a system so flexible, for the user
(dev or end user) that we end up making the system harder to maintain and
often harder to understand.

Looking back at my comment, I was a bit harsh on that one, as there may be a
legitimate reason for supporting all of the options. I still think that too
many options opens an application up for errors, much like scoping
variables/routines at too high a level.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
 
Back
Top