Error accessing Registry from Windows app

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Error accessing Registry from Windows app

    When attempting to access the Registry, I receive errors.
    I have attempted to add code to assert access to the key,
    but this does not help. The documentation on accessing
    the Registry is pathetic.

    Dim rp As New
    System.Security.Permissions.RegistryPermission
    (Security.Permissions.RegistryPermissionAccess.All Access,
    "HKEY_CURRENT_USER\SOFTWARE\MyApplication")
    oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey
    ("Software").OpenSubKey("MyApplication").OpenSubKe y
    ("Database")
    oKey.SetValue("Databases", "1")


    Error Message:

    An unhandled exception of
    type 'System.UnauthorizedAccessException' occurred in
    mscorlib.dll

    Additional information: Cannot write to the registry key.
    Steve Guest

  2. Similar Questions and Discussions

    1. 401 Error on Windows 2003 Server Accessing Web Service
      Hi. I have a web service running on 2003 Server. The client app running on the same machine gets a 401 error, but browsing the web service in...
    2. Accessing the server's registry in an ASP.Net Web Service...
      I've found this article on how to get ASP.Net to read/write from the server's registry, but it got heavily critted as being something that you...
    3. Getting an error while accessing Web Services from a Windows Client
      I have deployed the same web services in two machines. I have used Microsoft Web services extensions. The web service has a method Search. When...
    4. Problem accessing Windows 2003 DC Registry Keys
      Hi, I'm trying to read some Registry Keys I've created with a Web Service, in my workstation it works fine, but when i move it to a server (a...
    5. Error accessing the OLE registry.
      Hi all, Hopefully someone can shed some light on a radical error I am getting. I am using windows XP Corp Edition with IIS 5.1 as a dev...
  3. #2

    Default Re: Error accessing Registry from Windows app

    Use the Regedt32 tool (in Win2000) or Regedit (WinXP) to set read/write
    access on the particular registry key for the user your are trying to access
    with, or the group that the user(s) are a member of.

    --
    - Paul Glavich


    "Steve" <slraymond@hotmail.com> wrote in message
    news:002501c3b6a7$19f84300$a501280a@phx.gbl...
    > When attempting to access the Registry, I receive errors.
    > I have attempted to add code to assert access to the key,
    > but this does not help. The documentation on accessing
    > the Registry is pathetic.
    >
    > Dim rp As New
    > System.Security.Permissions.RegistryPermission
    > (Security.Permissions.RegistryPermissionAccess.All Access,
    > "HKEY_CURRENT_USER\SOFTWARE\MyApplication")
    > oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey
    > ("Software").OpenSubKey("MyApplication").OpenSubKe y
    > ("Database")
    > oKey.SetValue("Databases", "1")
    >
    >
    > Error Message:
    >
    > An unhandled exception of
    > type 'System.UnauthorizedAccessException' occurred in
    > mscorlib.dll
    >
    > Additional information: Cannot write to the registry key.

    Paul Glavich Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139