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

Problem with Uri.MakeRelative() method

When using the MakeRelative() method of the Uri class, I have noticed that
the Query and Fragment are never returned. I ran the following code and
recieved the following results:

Dim initialUri1 As New Uri("http://www.mydomain.com/index.aspx")

Dim initialUri2 As New Uri("http://www.mydomain.com/dir1/index.aspx")

Dim initialUri3 As New Uri("http://www.mydomain.com/dir1/dir2/index.aspx")

Dim fragmentUri As New Uri("http://www.mydomain.com/dir1/index.aspx#QUOTES")

Dim queryUri As New
Uri("http://www.mydomain.com/dir1/index.aspx?qname=myself")

Response.Write("Result for fragmentUri: " &
initialUri1.MakeRelative(fragmentUri) & "<br>")

Response.Write("Result for queryUri: " & initialUri1.MakeRelative(queryUri)
& "<br>")

Response.Write("Result for fragmentUri: " &
initialUri2.MakeRelative(fragmentUri) & "<br>")

Response.Write("Result for queryUri: " & initialUri2.MakeRelative(queryUri)
& "<br>")

Response.Write("Result for fragmentUri: " &
initialUri3.MakeRelative(fragmentUri) & "<br>")

Response.Write("Result for queryUri: " & initialUri3.MakeRelative(queryUri))
This gave me the following results:

Result for fragmentUri: dir1/index.aspx
Result for queryUri: dir1/index.aspx
Result for fragmentUri:
Result for queryUri:
Result for fragmentUri: ../index.aspx
Result for queryUri: ../index.aspx

As you can see, the correct path is always returned but the Query and
Fragment properties are completely ignored. Is there a way to return the
Query or Fragment without manually adding it?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
0 822

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

Similar topics

4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
4
by: Steve - DND | last post by:
We're currently working on a project with v1.0 of the .Net Framework, and are experiencing some issues with System.Uri. We have two Uri objects: Uri uriBase = new...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
0
by: Nathan Sokalski | last post by:
When using the MakeRelative() method of the Uri class, I have noticed that the Query and Fragment are never returned. I ran the following code and recieved the following results: Dim initialUri1...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
10
by: Markus Svilans | last post by:
Hi, I have a weird problem in a virtual method. The original method code raises an access violation when it is run. The solution to the problem is to declare a dummy integer inside the virtual...
4
by: amidzic.branko | last post by:
I'm trying to solve a problem using inheritance and polymorphism in python 2.4.2 I think it's easier to explain the problem using simple example: class shortList:
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.