Sunday, August 21, 2011

Be careful with your directory seperator when using Slverlight

I have observed something weird with the images in Silverlight:

In Visual studio you may specify the path towards an image using slash ("/") or backslash ("\") as separator: both give the correct result.

But if you run the silverlight application only the picture with the slash in the path does appear: the image whose path contains backslashes remains invisible.

May be the engine within visual studio uses Windows service to retrieve files and that service accepts both "/" and "\" as separators while the browser uses the HTTP conventions where the separator is always "/". Anyway for yor Silverlight developments be sure to always use "/" to avoid any problem.

No comments:

Post a Comment