Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I build an app and i want it to block surfing when a "user" didn't chose, but I can�t find a way to stop the network adapter from c#. I saw and tried a lot of examples and advices from all other the net, but none worked for me. I tried to disabled the adapter-

public void DisableNetWork(string interfaceName)

{

SelectQuery wmiQuery = new SelectQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionId != NULL");

ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(wmiQuery);

foreach (ManagementObject item in searchProcedure.Get())

{

if (((string)item["NetConnectionId"]) == "Local Area Connection")

{

try

{

item.InvokeMethod("Disable", null);

 

}

catch (Exception ex)

{

String s = ex.Message;

}

 

}

}

}

 

I tried socket bind to another process, so I can block the browsers, I tried disabling the drivers, but nothing worked so far. Do you any have working working idea for me? If you have, Please check if it working on win7 since I understood that there is a different between XP and 7.

 

Great thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...