Click here to Skip to main content
15,878,945 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In an interview an interviewer asked me :
"Suppose I have a wcf service.There are 3 methods say A1,A2,A3.
Now I have 2 clients . One will use only A1 and second one will use A2 and A3.
So How can I protect my A2 and A3 methods from First Client?"
Please help me?
Posted
Comments
John C Rayan 30-Jan-16 14:55pm    
This is a tricky question. Usually you cannot protect any clients from accessing the published methods. However you can prevent them executing the methods.
Sergey Alexandrovich Kryukov 30-Jan-16 22:36pm    
Rather, it's not a definitive question, strictly speaking, totally incorrect. There is no such concept as "first client" or "second client". It should be explained how should be distinguished as different. It should be an essential part of the question. Damn, those interviewers...
—SA

1 solution

use IP address to block

Request.UserHostAddress // use ip address
Request.UserHostName // use mac address


firstaddress 122.1.1.1
2ndaddress 111.1.1.13
check for ipaddress if is firstaddress then block from using A2 and A3
check for ipaddress if is 2ndaddress then block from using A1
 
Share this answer
 
Comments
John C Rayan 31-Jan-16 2:39am    
where will you check the IP addresses? Inside the methods right, if so the clients already accessed the methods. You can only stop them executing the business logic inside the methods but cannot stop them accessing it published methods.

It is better using certificates rather than using IP addresses for identifying clients.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900