Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:52:29+00:00 2026-06-07T17:52:29+00:00

I have a debian server and i saved its mac address on a txt

  • 0

I have a debian server and i saved its mac address on a txt file in the /usr folder.

Every time i start the machine the script i’m trying to do should check the current mac address and compare it to the one saved on the txt file. If they don’t match than the machine should shutdown.

The code works on Windows , but i have to make it work on debian. So i installed mono (apt-get install mono-complete) ,created the .cs file containing the code and transferred it on debian machine.

When i run the mcs shutdown.cs (shutdown is the name of the file i created) command i get this error :

CS0234: The type or namespace name ‘NetworkInformation’ does not exist i the namespace ‘System.Net’. Are you missing an assembly reference?**

How can this be solved?

using System.Net.NetworkInformation;

      static void Main(string[] args)
      {
          string newmc = Convert.ToString(GetMacAddress()); //current mac address
          string mc = File.ReadAllText(@"/usr/mc.txt"); //mac address saved on a       txt file previously
          if (newmc != mc)   //shutdown if the mac addresses dont match
          {
              System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0"); 
           }
      }
      static string GetMacAddress()
      {
          string macAddresses = "";
          foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
          {
             if (nic.NetworkInterfaceType != NetworkInterfaceType.Ethernet) continue;
             if (nic.OperationalStatus == OperationalStatus.Up)
             {
                macAddresses += nic.GetPhysicalAddress().ToString();
                break;
             }
           }
         return macAddresses;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:52:30+00:00Added an answer on June 7, 2026 at 5:52 pm

    System.Net.NetworkInformation.NetworkInterface class is in System.dll according to this: http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface . Did you try adding a reference to System.dll when compiling? I believe it’s the “-r” argument to mcs.

    BTW, what version of Mono are you using. Debian is famous for shipping very old versions of Mono in the “stable” flavour. Mono 2.10.x or higher is recommended, nowadays, as stable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a file share on a debian server which people will be putting
So I have Debian machine for my Django production server. I need to install
Hi i have a debian server. Today my site was showing Error establishing a
I have a server with debian. Server host X vservers (for example 1vserver to
OK, here's the deal. I have Git installed on my Debian (lenny) remote server.
I have problems with Darwin Streaming server 5.5.5 on Debian. When i'm trying to
I'm running Debian on a VPS server, and have both the development and production
I have deployed the WebDav server on Debian Linux and give appropriate permission. While
I'm proud to have rented my own debian 6.0 server. And as a total
We have a problem on Debian server and PHP version 4.4.4-8+etch6. In this script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.