简体   繁体   中英

asp.net web services(.asmx) authorization for particular method

I want to create a web service which has 2 methods and should be accessed by 2 clients. 1. First client should be able to access both the methods. 2. 2nd client should be able to access only one method.

How can I achieve this?

For 2nd Method add 1 more parameter (authenticationKey) and if key math then return data else show message Invalid key.

public string Method2(int ClientId, string authenticationKey)
{
   if(authenticationKey == "CSCdk33792")
   {
     ...
   }
   else
   {
      return "Invalid authenticationKey";
   }
}

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