473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to convert "~/xxx" to AbsoluteUri ?

I want to convert a path from ~/xxx/xxx.gif to 'http://xxxxxxx/xxx/xxx.gif'

how to convert it?

thanks
btw:

the convert function allow
1. '~/xxx/xxx.gif'
2. 'xxx/xxx.gif'
3. '/xxx/xxx.gif'
4. 'http://xxxxxxx/xxx/xxx.gif'

to
'http://xxxxxxx/xxx/xxx.gif' fotmat

how to do ?

tkanks

help
Jul 27 '07 #1
4 2469
Hi jiatiejun,

I suggest you read this web:

http://www.awprofessional.com/articl...01145&seqNum=1

Hope this helps.

"jiatiejun" wrote:
I want to convert a path from ~/xxx/xxx.gif to 'http://xxxxxxx/xxx/xxx.gif'

how to convert it?

thanks
btw:

the convert function allow
1. '~/xxx/xxx.gif'
2. 'xxx/xxx.gif'
3. '/xxx/xxx.gif'
4. 'http://xxxxxxx/xxx/xxx.gif'

to
'http://xxxxxxx/xxx/xxx.gif' fotmat

how to do ?

tkanks

help
Jul 27 '07 #2
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!
************************************************
"jiatiejun" <ji*******@126.comwrote in message
news:OM**************@TK2MSFTNGP04.phx.gbl...
>I want to convert a path from ~/xxx/xxx.gif to 'http://xxxxxxx/xxx/xxx.gif'

how to convert it?

thanks
btw:

the convert function allow
1. '~/xxx/xxx.gif'
2. 'xxx/xxx.gif'
3. '/xxx/xxx.gif'
4. 'http://xxxxxxx/xxx/xxx.gif'

to
'http://xxxxxxx/xxx/xxx.gif' fotmat

how to do ?

tkanks

help


Jul 27 '07 #3


"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:OA**************@TK2MSFTNGP04.phx.gbl...
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
Jul 27 '07 #4
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!
************************************************
"Mythran" <ki********@hotmail.comwrote in message
news:B5**********************************@microsof t.com...
>

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:OA**************@TK2MSFTNGP04.phx.gbl...
>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


Jul 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Juan Irigoyen | last post by:
How I can traduce this sentence in VB. Thanks. Dim arrSesions As DataRow() arrSesions = Context.Cache("SessionKeys").Select("xxx")
5
by: Greg Collins [InfoPath MVP] | last post by:
I couldn't find anything in my searches... I'm wondering if there's a Regex (with or without additional C# code) that can convert a either "lowerCamelCase" or "UpperCamelCase" into a proper "Title...
11
by: icanoop | last post by:
I would like to do this MyClass x; istringstream("XXX") >> x; // Works in VC++ but not GCC instead of MyClass x; istringstream iss("XXX"); iss >> x; // Works in both GCC and VC++
23
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target...
4
by: Lloyd Dupont | last post by:
I can't use Control.ResolveUrl because I need to write the conversion in a utility class. However I know the current context. How could I convert the URL to one usable by the user? -- I have...
1
by: robert | last post by:
some packages like paramiko use the logging. I get this messages: "No handlers could be found for logger xxx" on stderr I don't want to deal with this logging at all so far - its useless in this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.