Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 985
  • Last Modified:

ManagementObject not recognized in asp.net app

I'm trying to use the ManagementObject object to get information about my servers hard drive.  I added the namespace using System.Management;  But it still errors saying:
Error      11      The type or namespace name 'ManagementObject' could not be found (are you missing a using directive or an assembly reference?)      C:\Documents and Settings\Administrator\Desktop\SH_Source\Admin_Pages\Home.aspx.cs      92      1      C:\...\SH_Source\

It almost seems like my .NET framework doesn't include it, but it should I'd think.  Any ideas?
0
JT_SIRO
Asked:
JT_SIRO
  • 2
2 Solutions
 
käµfm³d 👽Commented:
Are you sure you have a reference added to "System.Management"? Just because the namespace is available, doesn't mean you're looking at the one you intend  = )
0
 
jijeeshCommented:
You need to add a Reference to System.Management dll.
0
 
JT_SIROAuthor Commented:
I have: using System.Management;  in my code so I'd think it'd work.
Is that what you meant by adding a reference to System.Management dll?  Or do I make the reference in a config file or something?

Here's the line of code that fails:
ManagementObject disk = new
0
 
käµfm³d 👽Commented:
>>  Is that what you meant by adding a reference to System.Management dll?

No. Go to Project-->Add Reference-->System.Management.dll


untitled.png
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now