ASMX Web服务的授权 [英] asmx web service authorization

查看:233
本文介绍了ASMX Web服务的授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我ASMX web服务(C#)。我使用Windows身份验证来访问Web服务。
现在我只需要为用户speciefic提供了一些Web服务方法,例如测试。我找不到这样的授权的例子。 code的一些例子是AP preciated。

I have asmx web service(c#). I'm using Windows Authentication to access web service. Now i need to provide some of web service methods only for speciefic user, for example Test. I cant find examples of such Authorization. Some examples of code would be appreciated.

推荐答案

我不认为Web服务都有每memeber这样的限制。也许你需要检查网络服务成员内的用户权限

I don't think that web service have such restriction per memeber. Probably you will need to check the user rights inside of the web service members

   [WebMethod]
   public void HelloWorld()
   {
      if (this.DoesUserHaveRights(HttpContext.Current.User))
      {
          // do the work here
      }
      else
         throw new AuthenticationException();
   }

或somethign像这样

or somethign like this

这篇关于ASMX Web服务的授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆