Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to restrict web service url call from external user ?

Thanks
Posted

 
Share this answer
 
Comments
Nelek 18-Oct-13 20:03pm    
Nice links, but it is 2003 and even MSDN says they are not accurated anymore.
If you want to restrict external users for access your web service then you can restrict external users ip address

http://stackoverflow.com/questions/1075618/limit-access-of-asmx-web-service-to-specific-ip-addresses/1075639#1075639[^]

if also can protect by code

C#
if (!Request.IsLocal)
{
    Response.StatusCode = 401;
    Response.StatusDescription = "Unauthorized";
    return null;
}


You need to check it from your every web method. Besides that you can write custom base webservice method and implement it there so that from every web method call it is checked.

If your web service is wcf service then you can implement the following stratigy

WCF Service Behavior Example: IPFilter - Allow/Deny Access by IP Address[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900