Whitelist Client via IP Address

pls review code snippet at Receiving information about client on server-side .
it shows how to client IP can be detected at server-side.
also in this event you can raise exception if wrong IP calls server method