Detect VPN via C# or api

扶醉桌前 提交于 2019-12-08 00:01:48

问题


I have a win app and I need to be able to help troubleshoot VPN issues that might be blocking my app. First I need to be able to tell if they have VPN or are connected to VPN.

I saw an older post on the same question (7months ago) with nothing definitive so I was curious if there were newer ideas or thoughts.

I suppose I can query the system folders for things like VPN or cisco but... it seems a little hack'ish.

Ideas or thoughts?


回答1:


Take a look at this link:

C# code to maintain VPN connection programatically

It uses ping to validate connections but also allows you to connect and disconnect.




回答2:


Here's an interesting thread

Failing that, I'd consider calling netsh through PowerShell.




回答3:


Look for the presence of another style of adapters besides Ethernet, list all of the network connections and their types, unless they have a 56.6k modem, if they have a PPP style adapter, it would strongly indicate a VPN tunnel.




回答4:


You should look at IPWarner, it's an API that contains millions of IP addresses in its database, which allows you to detect if the IP is good or not (Hosting/VPN/Proxy...)



来源:https://stackoverflow.com/questions/4940031/detect-vpn-via-c-sharp-or-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!