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. C#
  4. Access To Path Denied

Access To Path Denied

Scheduled Pinned Locked Moved C#
helpcsharpvisual-studiowindows-admindebugging
4 Posts 2 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.
  • B Offline
    B Offline
    BlitzPackage
    wrote on last edited by
    #1

    Good People, So, my software installs a file that is read/write while the application is running.   During debug, it works fine - read/write no problem.   So, I created an MSI (Windows Installer Project in Visual Studio 2008 Sp1) for the application.   It installs fine. However, now two problems have emerged: 1) It states that access to the path where the file is located has been denied (it's nested in Program Files). 2) I tried to uninstall it but it's telling me that the appropriate level of access to the registry (something about HKEY_CURRENT_USER roots, certificates, blah, blah...) is not present. Any help you can provide would be great. (What really irks me is that when I created the install project before, I never had this issue.   I bet it's some setting I missed. Oh well.) Thanks, Blitz

    L 1 Reply Last reply
    0
    • B BlitzPackage

      Good People, So, my software installs a file that is read/write while the application is running.   During debug, it works fine - read/write no problem.   So, I created an MSI (Windows Installer Project in Visual Studio 2008 Sp1) for the application.   It installs fine. However, now two problems have emerged: 1) It states that access to the path where the file is located has been denied (it's nested in Program Files). 2) I tried to uninstall it but it's telling me that the appropriate level of access to the registry (something about HKEY_CURRENT_USER roots, certificates, blah, blah...) is not present. Any help you can provide would be great. (What really irks me is that when I created the install project before, I never had this issue.   I bet it's some setting I missed. Oh well.) Thanks, Blitz

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, for 1) I am not surprised; you probably needed admin privileges to get your app installed (so all users can use it), however a regular user cannot write to Program Files and its descendents. Furthermore, one could make the whole app folder (or even Program Files) read-only for added protection, so the user trying to write files there is no good. I suggest you use one of the preferred file locations using the Environment.GetFolderPath() method, probably with the SpecialFolder.ApplicationData or .CommonApplicationData parameter. You can creaye subfolders and files in there as much as you need to or want to. Mind you, the actual path returned by GetFolderPath will depend on the specific Windows version, and some admin choices made while installing Windows; however the method takes care of all that. for 2) I have no idea. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      B 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, for 1) I am not surprised; you probably needed admin privileges to get your app installed (so all users can use it), however a regular user cannot write to Program Files and its descendents. Furthermore, one could make the whole app folder (or even Program Files) read-only for added protection, so the user trying to write files there is no good. I suggest you use one of the preferred file locations using the Environment.GetFolderPath() method, probably with the SpecialFolder.ApplicationData or .CommonApplicationData parameter. You can creaye subfolders and files in there as much as you need to or want to. Mind you, the actual path returned by GetFolderPath will depend on the specific Windows version, and some admin choices made while installing Windows; however the method takes care of all that. for 2) I have no idea. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        B Offline
        B Offline
        BlitzPackage
        wrote on last edited by
        #3

        Thanks Luc, I will use the strategy you suggest.

        L 1 Reply Last reply
        0
        • B BlitzPackage

          Thanks Luc, I will use the strategy you suggest.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          you're welcome. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


          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