473,388 Members | 1,427 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,388 software developers and data experts.

Relative URL's to absolute URL's function ?

wl
Hi,

I would like to create a new URL based on the URLReferer. Well it's
difficult to explain (which is probably I can't find anything on Google):

eg 1
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value =
"asecondfile.aspx"
--> http://www.mysite.com/somedir/asecondfile.aspx

eg2:
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value =
"../asecondfile.aspx"
--> http://www.mysite.com/asecondfile.aspx

eg2:
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value =
"http://www.anothersite.com/asecondfile.aspx"
--> http://www.anothersite.com/asecondfile.aspx

So this basically would need to translated relative URL's to absolute URL's.

Is there any method in the framework that can do this for me, without having
to write my own code ?

Thanks,

Wim
Nov 18 '05 #1
1 1446
wl
While describing my problem I found a good description and tried this in
Google, and I found it.

[C#]
Uri baseUri = new Uri("http://www.contoso.com/");
Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");

Console.WriteLine(myUri.AbsolutePath);

Thanks,

Wim
"wl" <so***@nospam.nospam> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
Hi,

I would like to create a new URL based on the URLReferer. Well it's
difficult to explain (which is probably I can't find anything on Google):

eg 1
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value = "asecondfile.aspx"
--> http://www.mysite.com/somedir/asecondfile.aspx

eg2:
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value = "../asecondfile.aspx"
--> http://www.mysite.com/asecondfile.aspx

eg2:
URLReferer = http://www.mysite.com/somedir/afile.aspx and given URL value = "http://www.anothersite.com/asecondfile.aspx"
--> http://www.anothersite.com/asecondfile.aspx

So this basically would need to translated relative URL's to absolute URL's.
Is there any method in the framework that can do this for me, without having to write my own code ?

Thanks,

Wim

Nov 18 '05 #2

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

Similar topics

4
by: Joe Cybernet | last post by:
Is there any function for combining an absolute and a relative URL to result in an absolute URL? Like if I have http://www.domain.com and "../images/1.jpeg" it will evaluate to...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
3
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following...
2
by: peter | last post by:
Hello all, I've read all the posts concerning relative imports of modules and I am glad I saw some consensus on a syntax. At this moment I am however bound to python 2.3. Does anyone know a...
5
by: John Williams | last post by:
I'm using the WebBrowser control and Microsoft HTML Object Library (MSHTML) in a VB .Net program. I'm trying to read <P> tags and their contents from one HTML document, test1.htm, and insert them...
10
by: tom | last post by:
hi group, i desperately need a function that will transform relative URLs to absolute URLs in the SRC part of <img> tags. ie: function makeAbsolute($html,$basehref) { //if regex match =...
6
by: Gérard Talbot | last post by:
Hello fellow stylers, When trying this page http://www.gtalbot.org/BrowserBugsSection/PercentualRelativePositioning.html I get different rendered layouts with IE 6, IE 7 beta 2, Firefox...
4
by: dropdeadster | last post by:
Trying to line up a tic-tac-toe board type grid of images using style= tags to <img inside a table TD but it's not working, I get more like a set of steps, can I get an explanation of what's wrong...
8
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the...
15
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.