2

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?

  • 1
    Pretty sure most browsers aren't going to tell you; why would they? – Marc Gravell Oct 04 '12 at 08:13
  • See this question.. [How to detect, from browser, if user is running in Remote Desktop session?][1] [1]: http://stackoverflow.com/questions/3417883/how-to-detect-from-browser-if-user-is-running-in-remote-desktop-session – Sen Jacob Oct 04 '12 at 08:29
  • It would have been very helpful if the question had actually got an answer... –  Oct 04 '12 at 08:37
  • Note to future readers: Even if this were possible, remote desktop is only one of many ways of proxying an http(s) connection, so detection of remote desktop wouldn't help in this timeclock scenario at all. The linked question has a much more reasonable rationale that actually is related to remote display (disable animations) and not just hiding the originating IP. – Ben Voigt Aug 26 '15 at 13:49

1 Answers1

0

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.

  • 1
    Oh, the *browser* shell could know easily enough. It just isn't going to tell the web-server (nor is it going to be available in the javascript on the viewed pages). – Marc Gravell Oct 04 '12 at 08:14
  • If I run a website in a remote connection, what is the Ip that i get from System.Web.HttpContext.Current.Request.UserHostAddress? Is it the ip of my local network or the ip of the network that the remote computer is connected? –  Oct 04 '12 at 08:21