System.Management namespace

G

Guest

I am using VS.Net 2000 and C# trying to access the System.Management
namespace in a Web Application -but- after:
using System;
using System.Management;
I get:
The type or namespace name "Management" does not exist in the class or
namespace "System"
How do I go about accessing the "Management" namespace...
I am trying to get the Serial Number of the CPU and Operating System from
examples I have found like:
//ManagementObjectSearcher searcher = new
//ManagementObjectSearcher("select * from win32_share");
//string MgmtTemp;
//foreach (ManagementObject share in searcher.Get())
// {
// // Console.WriteLine("Share = " + share["Name"]);
// MgmtTemp = share["Name"];
// }
There seems to be different limitations between Windows Applications "Forms"
and Web Applications - Why - aren't they both using the .Net
Framework/Runtime???
Thanks in advance,
Paul
 
W

Willy Denoyette [MVP]

PaulThomas said:
I am using VS.Net 2000 and C# trying to access the System.Management
namespace in a Web Application -but- after:
using System;
using System.Management;
I get:
The type or namespace name "Management" does not exist in the class or
namespace "System"
How do I go about accessing the "Management" namespace...
I am trying to get the Serial Number of the CPU and Operating System from
examples I have found like:
//ManagementObjectSearcher searcher = new
//ManagementObjectSearcher("select * from win32_share");
//string MgmtTemp;
//foreach (ManagementObject share in searcher.Get())
// {
// // Console.WriteLine("Share = " + share["Name"]);
// MgmtTemp = share["Name"];
// }
There seems to be different limitations between Windows Applications
"Forms"
and Web Applications - Why - aren't they both using the .Net
Framework/Runtime???
Thanks in advance,
Paul

There are no "different limitations", for both you have to add a reference
to the System.Management.dll. assembly when compiling.
VS will automatically add following entry to your web config file when you
add an assembly reference...

<assemblies>

<add assembly="System.Management, Version=....."/>

Willy.
 

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