Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

about the Uri relative path

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fairyvoice - 19 Mar 2008 14:02 GMT
hi, i just want to know when i new a Uri instance using the UriKind.Relative
para in construtor, where is the root path, for example, a local file
Uri u=new Uri("a.txt",UriKind.Relative);
then where is it? I thought it would be in the "object\debug" directory
where the exe file exists but nope
Can anyone tell me? I just want to get some local file using Uri with
relative path.
Thx in advanced
Peter Ritchie [C# MVP] - 19 Mar 2008 15:13 GMT
When you create a Uri as Relative it doesn't have any context.  You have to
provide the context by merging a Relative Uri with an Absolute Uri.  Your Uri
only contains "a.txt" (and many of the properties will throw an exception if
you try to use them).

It's a way of using a method that takes a Uri parameter without providing a
string or an Absolute Uri.

Signature

Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#

> hi, i just want to know when i new a Uri instance using the UriKind.Relative
> para in construtor, where is the root path, for example, a local file
[quoted text clipped - 4 lines]
> relative path.
> Thx in advanced
Paul E Collins - 19 Mar 2008 15:13 GMT
> hi, i just want to know when i new a Uri instance using the
> UriKind.Relative
> para in construtor, where is the root path, for example, a local file
> Uri u=new Uri("a.txt",UriKind.Relative);
> then where is it? I thought it would be in the "object\debug"
> directory

It's not anywhere, because it's a relative URI. It's just a fragment
that you can append to other URIs to make a longer one.

You want an absolute URI, not a relative one, since you know exactly
where your local file is.

Eq.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.