1. A method for controlling the access of a device to a remote desktop or a remote application running on a remote desktop or application server using a remoting protocol, comprising the following steps: Registration of the device with a device state server to store device identifying information, including a push notification token; Using the device state server to wake a device state application on the device in response to the detection of a connectivity between the device and the remote desktop or application server. Monitoring the device to determine a device state; Sending the device state from the device to the device state server which in turn forwards the device state to the remote desktop or application server; Determining based on the received device state if an access to the remote desktop or remote application running in the user session is allowed, and block the access if the access is due to the received state not allowed.