I created a sample Silverlight Web project
and I am getting ‘Access is denied’ when I do this:
string fileName = "map.gif";
FileInfo fileInfo = new FileInfo(fileName);
How can I give the web project access to this folder/file?
I added the image into my project, really drawing a blank here….
You don’t access files you’ve placed in the project using the
FileInfoobject. Instead you create a Uri to access it.Its not clear from your question which project you’ve place the file in. If you have placed it in the Silverlight project then it ought to end up as content in the Xap. In which case you can acquire
StreamResourceInfofor it using:-Now you can get to the file content with:-
On the other hand if you have placed the file in the web project it will be a standard static file in the web site. Hence you will need to do the typical
WebClientdownload to fetch it.I take it you are going to this trouble because its a Gif file; you are aware that they are not supported as an image.