Converting Relative URLs into Absolute URLs

Converting Relative URLs into Absolute URLs

Post by Nathan Sok » Wed, 13 Aug 2008 06:01:50


I am using the System.Net.WebClient() and System.Text.UTF8Encoding() classes
to get the output from another page of mine. My basic main algorithm is the
following:

utf8.GetString(source.DownloadData(finalurl))

However, it keeps telling me

Illegal characters in path.

However, the value of finalurl that I am passing is the following:

/Default.aspx?p1=1&p2=2&p3=3

This is definitely a valid relative URL, so I am guessing that I just need
to make it an absolute URL. Is there any method that can change a relative
URL into an absolute one for me so that I don't need to do it manually by
concatenating strings? Thanks.

Nathan Sokalski
XXXX@XXXXX.COM
http://www.yqcomputer.com/
 
 
 

Converting Relative URLs into Absolute URLs

Post by Sriram Sri » Wed, 13 Aug 2008 16:03:23

Look up the URIBuilder class. May help.