How to deny access to specific Web Methods in WCF in ASP.Net

on Sep 22, 2014 04:13 AM


I have created one service and i am having two methods in it. I am having two clients who all are consuming that service so that all the two methods are available to the clients.

So my question is, for one of the client, i need to hide one method from the service. Can any one please let mw know how could able to achieve this.


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Sep 23, 2014 02:51 AM
on Sep 24, 2014 08:23 AM

1. You will have to separate out the service as it is not possible to hide any Public method for any client.

2. Also you can pass ID of Client in all Web Methods and keep in record in datable table where you can save permissions to WebMethod.

Thus if the Client does not have permission you can throw an error or Exception which will make it unusable for the client.

That's how FaceBook, Google and other companies do for the APIs.