4

how to get network connection list in my computer with c# vpn list or other

in windows 7 this path Control Panel\Network and Internet\Network Connections

i need for write a function to connect to internet in c#

1
  • 1
    Are you looking for network interfaces, VPNs, TCP sessions, connected shares, or something else? Commented Apr 5, 2010 at 4:05

1 Answer 1

6

I assume you're looking for the list of network interfaces.

The System.Net.NetworkInformation.NetworkInterface class is probably what you are after, specifically the GetAllNetworkInterfaces() method.

To get the same list as Control Panel, I suspect you will also need to filter on the NetworkInterfaceType property value, to skip loopback and tunneling interfaces.

Sign up to request clarification or add additional context in comments.

3 Comments

i need to get active and deactivate connection list but in you answer only active connection showed
I don't believe you can do this using the .NET APIs, you will probably need to use P/Invoke. If you need this for programmatically enabling/disabling a particular interface, there is this existing question: stackoverflow.com/questions/860673/…
no this link for disable card but i looking for connect to internet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.