Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Problem with Uri.MakeRelative() method

Thread Tools

Problem with Uri.MakeRelative() method

Nathan Sokalski
Posts: n/a
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("")

Dim initialUri2 As New Uri("")

Dim initialUri3 As New Uri("")

Dim fragmentUri As New Uri("")

Dim queryUri As New

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 Removed)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
method def in method vs method def in block Kyung won Cheon Ruby 0 11-21-2008 08:48 AM
algorithm for Modified Distribution Method / Transportation Simplex Method/Transport Problem C++ 1 01-12-2005 02:27 AM
algorithm for Modified Distribution Method / Transportation Simplex Method/Transport Problem Deepak C Programming 1 01-11-2005 07:18 AM
Problem: return from one method when another method is called Magne Bergfjord Java 1 04-20-2004 04:25 PM
Problem posting a method as an argument to an method.. =?ISO-8859-1?Q?Christian_M=F6rck?= C++ 4 11-21-2003 07:38 AM