Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. File drag and drop in in-browser app

File drag and drop in in-browser app

Scheduled Pinned Locked Moved WPF
questionsecuritydebuggingannouncement
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CCB2010
    wrote on last edited by
    #1

    I have an SL 5 app that the user can drop files and directories into. When launched from the debugger, it works as expected. When I try to use the xap in a page on a remote site, I get a Security exception. foreach (FileInfo fi in files) { // _files.Enqueue(fi); if (fi.Attributes == FileAttributes.Directory) Attaching the debugger to the browser, I see: +fi.Attributes 'fi.Attributes' threw an exception of type 'System.Security.SecurityException' System.IO.FileAttributes {System.Security.SecurityException} "File operation not permitted. Access to path '' is denied." UPDATE: Some properties of the FileInfo object are available, but not things like Attributes, Directory, DirectoryName. 1) Why does it work when started from the debugger? 2) How can I get it working outside of the debugger? Thanks for any insight....

    L 1 Reply Last reply
    0
    • C CCB2010

      I have an SL 5 app that the user can drop files and directories into. When launched from the debugger, it works as expected. When I try to use the xap in a page on a remote site, I get a Security exception. foreach (FileInfo fi in files) { // _files.Enqueue(fi); if (fi.Attributes == FileAttributes.Directory) Attaching the debugger to the browser, I see: +fi.Attributes 'fi.Attributes' threw an exception of type 'System.Security.SecurityException' System.IO.FileAttributes {System.Security.SecurityException} "File operation not permitted. Access to path '' is denied." UPDATE: Some properties of the FileInfo object are available, but not things like Attributes, Directory, DirectoryName. 1) Why does it work when started from the debugger? 2) How can I get it working outside of the debugger? Thanks for any insight....

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Have you tried running as normal and then attaching to the process? This may give you the details of the exception and then you would understand why.

      Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

      C 1 Reply Last reply
      0
      • L Lost User

        Have you tried running as normal and then attaching to the process? This may give you the details of the exception and then you would understand why.

        Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

        C Offline
        C Offline
        CCB2010
        wrote on last edited by
        #3

        The OP contains the exception I see when attaching the debugger to the browser. Certain properties of the FileInfo appear to be unavailble -- Attributes, Directory, DirectoryName -- when running outside of the browser.

        L 1 Reply Last reply
        0
        • C CCB2010

          The OP contains the exception I see when attaching the debugger to the browser. Certain properties of the FileInfo appear to be unavailble -- Attributes, Directory, DirectoryName -- when running outside of the browser.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          It seems what ever the silverlight app is running under does not have such permissions for the locations you are hitting then. When you run using the debugger you are running with elevated privileges.

          Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

          S 1 Reply Last reply
          0
          • L Lost User

            It seems what ever the silverlight app is running under does not have such permissions for the locations you are hitting then. When you run using the debugger you are running with elevated privileges.

            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

            S Offline
            S Offline
            SledgeHammer01
            wrote on last edited by
            #5

            As Colin mentioned (sort of :)), this is Silverlight. It runs in a locked down sandbox environment and does not have access to local resources (files, registry, etc.). If you want to have access to those types of things, you need to specify that you want elevated permisions in your config file.

            C 1 Reply Last reply
            0
            • S SledgeHammer01

              As Colin mentioned (sort of :)), this is Silverlight. It runs in a locked down sandbox environment and does not have access to local resources (files, registry, etc.). If you want to have access to those types of things, you need to specify that you want elevated permisions in your config file.

              C Offline
              C Offline
              CCB2010
              wrote on last edited by
              #6

              Thanks for the reply. A hint on how to specify the elevated permissions would be appreciated... (Weird: when I build and run the project -- from the debugger -- on a different computer, the app does not have elevated permission. Trying to figure out the difference between the two computers. I have this code in a handler for the MainPage Loaded event:

              Msgs.Text = string.Format("{0} ElevatedPermissions", (Application.Current.HasElevatedPermissions ? "Has" : "Does NOT have"));

              )

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups