problem with impersonate

Y

Yoshitha

Hi
I've to access registry and also get cpu id from the web application.
First i wrote code to get cpuid from web application then i got cpu id.
Next i wrote code to set value into a registry and when ran the application
i got error that access to Registry is denied some thing.
and then what i did is i changed the impersonate="true" from false in
identity section of the machine.confog file.
and then ran the application then i successfully placed the value into the
registry, but i couldnt get the cpu id.

again icnaged the impersonate to false now it is working for cpu id and not
for registry.

Can anybody tell me the solution for my problem.
i've to access registry and also get cpuid how can i achieve this.
Its very urgent for me
Thanx in advance
Yoshitha
 
G

Guest

Hello Yoshita,

Could you copy the code snippet you are using to get the CPUID.

Stuart
 
Y

Yoshitha

i wrote the following code to get the cpu id

Public Function GetCPUId() As String

Dim cpuInfo As String = String.Empty

Dim temp As String = String.Empty

Dim mc As ManagementClass = New ManagementClass("Win32_Processor")

Dim moc As ManagementObjectCollection = mc.GetInstances()

Dim mo As ManagementObject

For Each mo In moc

If cpuInfo = String.Empty Then cpuInfo =
mo.Properties("ProcessorId").Value.ToString()

Next

Return cpuInfo

End Function



and am getting error in this line

Dim moc As ManagementObjectCollection = mc.GetInstances()

system.management.managementexception Access Denied.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top