Banketeshvar Narayan
Banketeshvar Narayan

Reputation: 3899

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?

Upvotes: 0

Views: 398

Answers (1)

Rachit Patel
Rachit Patel

Reputation: 862

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";
   }
}

Upvotes: 2

Related Questions