1. A method in a server of a private network for dynamically setting up a session between a target resource in the private network and an application on a device, wherein the device belongs to the private network but may be located remotely from the private network, the method comprises receiving from the application a request to get the target resource in the private network, checking if a user of the device is authorized to access the server, identifying a session anchor, instantiating a proxy agent within the private network with address information of the identified session anchor such that the proxy agent can establish a connection to the session anchor identified by said address information, receiving a session Universal Resource Locator, URL, in response to said instantiating and performing a mapping between a URL of the target resource and a session URL issued by said session anchor, and determining whether the device and the target resource are on the same Local Area Network, LAN, such that the application can access the target resource directly if they are on the same LAN, or such that the application can access the target resource via the session anchor by using the session URL if they are not on the same LAN.