I am developing a website with a time-clock system and i understand if the user is running the site in my network by getting his ip:
System.Web.HttpContext.Current.Request.UserHostAddress
The problem is if the user runs the website from home by connecting his computer to another computer which is in his office.
I need to detect if it is a remote desktop connection or not.
I tried both HttpContext.Current.Request.IsLocal and System.Windows.Forms.SystemInformation.TerminalServerSession but these will return both false if I run the published website in a Remote Desktop Connection. They work fine only when I build the website locally.
Any ideas how to deal with this situation?
You can’t. The client’s browser has no way of knowing whether it’s being accessed locally or not, so there’s no way that it can tell you.
More precisely, there is no mechanism specified by browser standards or de facto standards by which the browser detects whether or not the current session is remote, and forwards that information to the server.
I’m sure you can write a proof of concept browser or browser plugin that will do what you need, and mandate that all accesses to your web site be through this particular program, but it is insecure and will likely annoy your users.