Jump to content

So i have this code

private static string GetMacAddress()		{			string macAddresses = string.Empty;			foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())			{				if (nic.OperationalStatus == OperationalStatus.Up)				{					macAddresses += nic.GetPhysicalAddress().ToString();					break;				}			}			return macAddresses;		}

I'm not entirely sure what all the parts mean, but i suppose it would only get the mac address of the machine that the file is started on.

I'm curious, is there a way to write the code, so that it would check if the mac address of the connecting machine is allowed (is in database(text file) ) to see that content on my web page. lets say we have a page mytestpage.com/content/checkmac.cs , (not sure if it should be .cs also) and if the mac is allowed to pass, it would redirect to /content/playlist.xml if not it would displaya message.

i5-4690k, R9 380 4gb, 8gb-1600MHz ram, corsair vs 550w, astrock h97m anniversary.

 

Link to comment
https://linustechtips.com/topic/464162-c-mac-address/
Share on other sites

Link to post
Share on other sites

Yes, but you must find a way to import the text file into the program you are running the code off of.

For example if done in javascript, i would probably use the java excel tools to connect the excel page as an array for it to recognise the data. New data then can be written into the program as a text file or via javascript.

Link to comment
https://linustechtips.com/topic/464162-c-mac-address/#findComment-6229926
Share on other sites

Link to post
Share on other sites

Yes, but you must find a way to import the text file into the program you are running the code off of.

For example if done in javascript, i would probably use the java excel tools to connect the excel page as an array for it to recognise the data. New data then can be written into the program as a text file or via javascript.

file would not be a prob, just the case of now knowing how to rewrite this code, so that it would check the incoming machines  mac address

i5-4690k, R9 380 4gb, 8gb-1600MHz ram, corsair vs 550w, astrock h97m anniversary.

 

Link to comment
https://linustechtips.com/topic/464162-c-mac-address/#findComment-6229970
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×