Hey all,
I'm trying to detect if VPN connected or not for a web application. For that, I've written the below shown csharp code and integrated with Outsystems. But it is fetching outsystems server machine location network details, but when I run the same code on local machine, it is fetching correctly.
Can anyone suggest any other approach to detect VPN for web application or how to fix the above mentioned issue by helping get client network location details?
Thanks,
Sahithi
Hi,
There are already 2 components available in the Forge to detect VPN.
https://www.outsystems.com/forge/list?q=vpn&t=&o=most-popular&tr=False&oss=False&c=%20&a=&v=&hd=False&tn=&scat=forge
Regards,
Daniel
Hi Daniel,
Thankyou for the response. But I see both are compatible for mobile application only not for web apps.
Well you need the logic to run in the browser to detect the VPN, you cannot do that server side. You should be able to do a similar thing you coded in C#, in Javascript, see for example:
https://github.com/dubniczky/VPN-Detect
You could use a free service like this.
https://www.abstractapi.com/guides/how-to-detect-if-an-ip-address-is-using-a-vpn
Hello Gnana,
I believe the reason your solution only works locally is that it returns NetworkInterface data for whoever is executing the code: since the server is the one running it, you get results for the server instead of the client connecting to you.
Daniel linked two components that are promising, but they both appear to be javascript based, which means the client is the one determining if it is running a VPN and returning you the answer - this is fundamentally more insecure than running a solution on your server, but it may be enough for your purposes. The first one appears to be Cordova based so it will not work on a Reactive context but the second one has no mentions of Cordova, which means it may be a good source of inspiration.
Regardless of what you decide to implement, this is not an easy requirement: if detecting VPNs was trivial, Netflix, Amazon, BBC and all other content providers would have implemented it a long time ago. You could also run a check against known VPN IP lists, but this solution comes with its own problems: static IP banlists are hard to keep updated, and can suffer from false positives.