Click here to Skip to main content
14,300,487 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have the following code where I try to search and display the pdf files of a specific path

var files = Directory.EnumerateFiles(@"\\\UploadFileMobilePDF\" + transfer.IdTransfer, "*.pdf", SearchOption.AllDirectories);
            foreach (var file in files)

but silverlight does not let me access that route, I want to know how to do the same function, but in silverlight, search and display the pdf files

What I have tried:

System.Windows.Browser.HtmlElement myFrame = System.Windows.Browser.HtmlPage.Document.GetElementById("_sl_historyFrame");
            if (myFrame != null)
                myFrame.SetStyleAttribute("width", "1024");
                myFrame.SetStyleAttribute("height", "768");
                Uri uri = new Uri(HtmlPage.Document.DocumentUri, @"\\\UploadFileMobilePDF\" + transfer.IdTransfer + "\\127fa8fa-7b03-4ce0-bfef-206c589ef0cf.pdf");

                string path = uri.AbsoluteUri.ToString();
                myFrame.SetAttribute("src", path);
                myFrame.SetStyleAttribute("left", "0");
                myFrame.SetStyleAttribute("top", "50");
                myFrame.SetStyleAttribute("visibility", "visible");

I want to do how to access a shared folder using silverlight
F-ES Sitecore 11-Sep-19 10:46am
Are you getting any error messages?
Member 14587461 11-Sep-19 10:56am
yes, a SecurityException
File operation not allowed. Route Access "\\\myfolder\myfile" denied
And in that folder I have permissions for everything
F-ES Sitecore 11-Sep-19 11:00am
There's your problem then :) You don't just need permissions on the folder, you need them on the network share too and your code also needs to be able to access the network. If you google "silverlight UNC" I'm sure you'll find various pages about the issue, if it's possible to resolve and what you do to resolve it.
Member 14587461 11-Sep-19 11:23am
Then silverlight can access the files of that address with the respective permissions that way
Richard Deeming 4 days ago
NB: Silverlight is effectively dead. The only browser that still supports it is Internet Explorer, where support for v5 will end in 2021.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100