dotnet 2/3 Vs2008 - uri-syntax not explained

  • Thread starter Thread starter Rolf Welskes
  • Start date Start date
R

Rolf Welskes

Hello,
siince .net 3.0 Uri is highly used for access to images etc.
But in the past only there where simple Uri-Syntax, now it's complex
and I do not find anywhere in the msdn the describtion of the syntax.

For examle Uri u = new Uri(http://mypage.com) ist no problem,
but what are things like:

Uri = u = new Uri(",,/.././abc.gif") (this surely is wrong, but looks
similar.)

I cannot understand this and cannot find a describtion of this syntax.

Thank you for any help.

Best Regareds
Rolf Welskes
 
Hi Rolf,

As for the Uri class, it is used to provide a strong-type represent of the
standard Uri which is defined in RFC 2396 below:

RFC 2396
http://www.ietf.org/rfc/rfc2396.txt

Uri(Uniform Resource Identifier) is not limited to http based url string,
but also other non-http url like identifier strings. And the below one you
mentioend:

Uri(",,/.././abc.gif")

should be a relative url. You can find many other possible Uri format in
the RFC definition.

BTW, as you mentioned that .NET 3.0 used much Uri, do you mean those Uri
path in WCF or anything else?I know that webservice, WCF will use Uri
string for service namespace or something else.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.





--------------------
 
Hello,
thank you.
But I only need simple notation - to study the specification is much work.
I have a very simple problem:

think I have folders

myApp
- bin
- debug
- AAA

Now in AAA I have for example MyPicture.jpg .

Naive if I need the file in path notation I would think:
the program runs in debug, so the relativ path is path =
...\..\AAA\MyPicture.jpg .
So naive I think
Uri u = new Uri("../../AAA/MyPicture.jpg", UriKind.Relative)

But with this relativ uri the picture is not found
I do not want to use Pack:/// - notation, but simple use a file on the disk
For example BitmapSource bms = new BitmapSource(myUri);

It would be very nice if you could tell me where I think wrong.

Thank you.
Rolf Welskes
 
Hi Rolf,

Thanks for your reply.

As for your application, would you tell me the project type? is it a WPF
application? I think I'll need to do some test also so as to confirm the
behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: "Rolf Welskes" <[email protected]>
References: <[email protected]>
Subject: Re: dotnet 2/3 Vs2008 - uri-syntax not explained
Date: Thu, 31 Jan 2008 23:54:22 +0100
 
Hello,
tank you,
yes, it's a wpf application.
simple I want to use images, but not from resources, but from the files.

Best Regards
Rolf Welskes
 
Hi Rolf,

After some research about the Image(also other static resource Uri) path in
WPF. I found that the case your image path is in a super directory of the
application's executable is not quite supported by a direct relative path
since WPF windows application currently only support too kind of relative
path schema that need you to specify a path under or at the same directory
of the executables.

Here are the reference of the two PACK URI schemes for WPF static resource
loading:

#Pack URIs in Windows Presentation Foundation
http://msdn2.microsoft.com/en-us/library/aa970069.aspx

#More on resource loading in WPF
http://nerddawg.blogspot.com/2005/12/more-on-resource-loading-in-wpf.html

If you want to specify a resource at external level/path, I think you may
consider programmtically construct the url at runtime and assign it to
Image element.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Rolf Welskes" <[email protected]>
Subject: Re: dotnet 2/3 Vs2008 - uri-syntax not explained
Date: Fri, 1 Feb 2008 14:04:57 +0100
 
Back
Top