简体   繁体   中英

asmx web service authorization

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM