Remoting - customer information. WITH#

Is it possible to find out / get some information about a connecting client when using remote access on .net 2.0? I like to get server-side client information so I can act accordingly? This is a small and very local application in which there will never be more than 10 simultaneous connections / client requests.

pass client link in each function? (or some identifier)? I could do it this way, but I would rather just get the information from the request / connection client. An ip address or the like would be nice.

Hello

+4
source share
3 answers
+3
source

This question may have the answer you are looking for.

I removed the parts that probably don't matter to you and left the part that really captures IPAddress.

public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestmessage, ITransportHeaders requestHeaders, System.IO.Stream requestStream, out IMessage responseMessage, out ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { // Get the IP address and add it to the call context. IPAddress ipAddr = (IPAddress)requestHeaders[CommonTransportKeys.IPAddress]; } 
+1
source

This question shows the explicit URI format, that is, the ObriRef URI property you get from RemotingServices.GetObjRefForProxy when you pass the remote object to it. The line between the first two slashes is the GUID of each process that uniquely identifies the client from the point of view of the local program.

In my case, I just needed a way to identify the client, not its IP address (which is not valid anyway with a channel other than TCP), so this worked for me.

0
source

Source: https://habr.com/ru/post/1285737/


All Articles