asmx web service authorization

怎甘沉沦 提交于 2019-12-08 03:10:19

问题


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.


回答1:


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();
   }

or somethign like this



来源:https://stackoverflow.com/questions/7267218/asmx-web-service-authorization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!