How i can restrict specific users to access few web methods in webservice

if my web service has 5 methods, say method1(), method2(), method3(),method4() and method5(). and two clients a and b. then is it possible that client a only see method1() and method2(). and client b only see method 3,4 and 5.

is it possible in webservice? if yes , then how?


When you mean 'call' by 'see': yes. You could test the credentials of the user and accordingly grant or deny access.

When you mean 'published in meta data (MEX/WSDL)' by 'see': yes, but not easily.

You could publish customized meta data for each user(group) and grant/deny access to the meta data. Visual Studio does not support this scenario; you'll have to adjust the WSDL and control access.

Another thing is that Visual Studio does not allow you to pass credentials to the site when trying to retrieve meta data other than by running Visual Studio as that user. So this might hinder you in setting a service reference.

You could turn of security for a while to circumvent this.

链接地址: http://www.djcxy.com/p/60428.html

上一篇: 如何拦截WCF Web方法请求?

下一篇: 我如何限制特定用户访问webservice中的几个Web方法