Error: File operation not allowed. Access to route denied C # SILVERLIGHT RRS feed

  • Question

  • I am working on a project that uses Silverlight, where I want to show PDFS files of a server path, but when I start debugging my code I find the following exception:

    where I generate the flow in the following code:

    System.Windows.Browser.HtmlElement myFrame = System.Windows.Browser.HtmlPage.Document.GetElementById("_sl_historyFrame");
                if (myFrame != null)
                    DirectoryInfo folderPath = new DirectoryInfo(@"\\\UploadFileMobilePDF\" + transfer.IdTransfer);
                    foreach (var file in folderPath.EnumerateFiles("*.pdf", SearchOption.AllDirectories))
                        myFrame.SetStyleAttribute("width", "1024");
                        myFrame.SetStyleAttribute("height", "768");
                        Uri uri = new Uri(folderPath + file.FullName);
                        string path = uri.AbsoluteUri.ToString();
                        myFrame.SetAttribute("src", path);
                        myFrame.SetStyleAttribute("left", "0");
                        myFrame.SetStyleAttribute("top", "50");
                        myFrame.SetStyleAttribute("visibility", "visible");
    The error marks me when instantiating the DirectoryInfo class folderPath = new DirectoryInfo ()

    I don't know if silverlight can't have permissions to server addresses

    Edgar Rojas H.

    Monday, September 9, 2019 1:58 PM

All replies

  • Hi,
    It seems nothing with WCF, here are some advice.
    When we operate on a folder/file, make sure that the account that executes the application has read and write access to that file/folder. Also,  please save the credentials to access the remote server in credential manager in case the server needs additional credential.
    Best Regards
    Tuesday, September 10, 2019 6:42 AM