Hi All,
I am attempting to write values to the registry, but get an
UnauthorizedAcc essException when I try to do a SetValue on an existing key.
However, I can create the key, with a value, when it does not exist.
Here is a snippet of the code:
Dim RegKey As RegistryKey
RegKey = Registry.LocalM achine.OpenSubK ey(BaseKey & "\" &
SubKey, False)
If (RegKey Is Nothing) Then
RegKey = Registry.LocalM achine.CreateSu bKey(BaseKey &
"\" & SubKey)
End If
Try
RegKey.SetValue ("NumberRuns ",
Tasks(I).Number Runs.ToString() )
RegKey.SetValue ("TotalSeconds" ,
Tasks(I).TotalS econds.ToString ())
Catch ex As Exception
MessageBox.Show ("Exception: " & ex.Message)
Finally
RegKey.Close()
End Try
What do I need to do to be able to update this key?
Thanks,
pagates 3 11564
Hello Pegates,
How are you doing?
The error that you have specified could be due to lack of rights on the
machine. Try checking the rights of the user.
Also the OpenSubKey method has an overload that provides write access. Try
passing true to it, instead of False as you are doing:
RegKey = Registry.LocalM achine.OpenSubK ey(BaseKey & "\" & SubKey,
False) ----- try passing True instead of False
I hope this helps.
Thanks
Mona
[Grapecity]
"pagates" <pa*****@discus sions.microsoft .com> wrote in message
news:D5******** *************** ***********@mic rosoft.com... Hi All,
I am attempting to write values to the registry, but get an UnauthorizedAcc essException when I try to do a SetValue on an existing
key. However, I can create the key, with a value, when it does not exist.
Here is a snippet of the code: Dim RegKey As RegistryKey RegKey = Registry.LocalM achine.OpenSubK ey(BaseKey & "\" & SubKey, False) If (RegKey Is Nothing) Then RegKey = Registry.LocalM achine.CreateSu bKey(BaseKey & "\" & SubKey) End If Try RegKey.SetValue ("NumberRuns ", Tasks(I).Number Runs.ToString() ) RegKey.SetValue ("TotalSeconds" , Tasks(I).TotalS econds.ToString ()) Catch ex As Exception MessageBox.Show ("Exception: " & ex.Message) Finally RegKey.Close() End Try
What do I need to do to be able to update this key?
Thanks, pagates
Hi Mona,
It was that stupid parameter...D'o h! (Yes, blame the parameter, not the
programmer) : )
Thanks again,
PAGates
"Mona" wrote: Hello Pegates, How are you doing?
The error that you have specified could be due to lack of rights on the machine. Try checking the rights of the user.
Also the OpenSubKey method has an overload that provides write access. Try passing true to it, instead of False as you are doing: RegKey = Registry.LocalM achine.OpenSubK ey(BaseKey & "\" & SubKey, False) ----- try passing True instead of False
I hope this helps.
Thanks Mona [Grapecity]
"pagates" <pa*****@discus sions.microsoft .com> wrote in message news:D5******** *************** ***********@mic rosoft.com... Hi All,
I am attempting to write values to the registry, but get an UnauthorizedAcc essException when I try to do a SetValue on an existing key. However, I can create the key, with a value, when it does not exist.
Here is a snippet of the code: Dim RegKey As RegistryKey RegKey = Registry.LocalM achine.OpenSubK ey(BaseKey & "\" & SubKey, False) If (RegKey Is Nothing) Then RegKey = Registry.LocalM achine.CreateSu bKey(BaseKey & "\" & SubKey) End If Try RegKey.SetValue ("NumberRuns ", Tasks(I).Number Runs.ToString() ) RegKey.SetValue ("TotalSeconds" , Tasks(I).TotalS econds.ToString ()) Catch ex As Exception MessageBox.Show ("Exception: " & ex.Message) Finally RegKey.Close() End Try
What do I need to do to be able to update this key?
Thanks, pagates
Well, what is the programmer to do when the parameters forget to set
themselves?? :) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bruce |
last post by:
I'm able to use RegistryKey.OpenRemoteBaseKey to read a value on a remote machine's registry, but I'm
unable to write to the key using .SetValue, getting an unauthorized access exception.
As I'm an administrator, what do I need to do to write to a remote registry key?
Bruce
|
by: Scott Vercuski |
last post by:
Everyone,
I'm having trouble writing an event to the event log. Here is the
chunk of code I currently have.
-----------------------------------------------------------------------
Private Shared Function WriteErrorToLog(ByVal objError As
System.Text.StringBuilder, ByVal strSource As String) As Boolean
Dim objEL As New EventLog
Dim blnreturnvalue As Boolean
|
by: Clint |
last post by:
Hey all -
I'm having a really confusing problem concerning a web service. Right
now, I have an application that needs to call a web service that does
nothing but return "true" (this will obviously change once the
program's fully built to actually do something, but for testing, it
works).
The only code I added to the service is below:
|
by: Kevin Swanson |
last post by:
I'm attempting some remote registry manipulation via C#. I've written a test
app to simply grab a specified key from a specified hive on a specified
machine. The call to OpenSubKey is throwing System.SecurityException.
Also of note: Sitting at my local box, I can open regedit and connect to the
remote registry. I see three hives: _CLASSES_ROOT, _LOCAL_MACHINE, and
_USERS. I can open all but HKEY_LOCAL_MACHINE. When I try to expand that...
|
by: Ravi |
last post by:
Hi,
Could any one please tell me if there's any way to set the value of a
particular registry key equal to that of another registry key that's already
present in the registry.
Thank you.
Ravi.
| |
by: Mostafa Salama |
last post by:
i have a problem in accessing registry from web service
i made a web service that call a function to access registry
The web service contain the following code
Dim RegKey As Microsoft.Win32.RegistryKey
RegKey = Microsoft.Win32.Registry.LocalMachine
RegKey = RegKey.OpenSubKey(KeyPath, True)
but it gives me an error, unauthorized access of registry
thanks
|
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in '/CinemaBookingSystem' Application.
--------------------------------------------------------------------------------
ERROR General error
Unable to open registry key 'Temporary (volatile) Jet DSN for process
|
by: Leslie |
last post by:
Using VS 2005 on Windows XP with SP2, I am attempting to write to the
application log.
I receive a dialog box that says: "Addiyional information: Ther source was
not found, but some or all event logs could not be searched. Inaccessible
logs: Security."
How should I correct this error?
|
by: gnewsgroup |
last post by:
In my web application, I need to access a simple web site on a remote
host. That web site only allows Integrated Windows Authentication.
So, in my web application, I collect user name, password and domain
info and pass it to that remote web site.
I keep getting this Exception:
The remote server returned an error: 401(Unauthorized.)
Whereas, I can check out that website just fine in IE or FireFox by
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |