Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to provide security to asmx web service to restrict external user?

What I have tried:

I don't have tried anything for above mentioned issue..
Posted
Updated 2-Aug-16 19:04pm
Comments
ZurdoDev 2-Aug-16 7:16am    
From even calling the web service?

From inside the service just make sure they pass a token and verify it or use IIS authentication.
Member 11774876 2-Aug-16 8:00am    
@RyanDev, an actual problem is on our hosted site users saying that, the data they are passing affected by some malicious data. Automatically different data getting saved to the actual result they have passed.

Some of the help I have got says "It's just the security around web service call is not tight enough."

I have added following section to web.config.

<location path="CompleteService/Methods.asmx" allowoverride="false">
<system.web>
<authorization>
<deny users="?">




Does this would restrict external users to do so?
Member 11774876 2-Aug-16 8:04am    
How can I check for token/verify it?

you can manage the resource through .config
Apply a <location> tag for the resources you want secured. Assuming it's a single ASMX file you can simply do the following in your web.config:
XML
<location path="MyWebService.asmx">
    <system.web>
        <!-- resource specific options will go here -->
    </system.web>
</location>


Second method you use as follows:-

C#
The simplest approach to securing the resource is to basically say: "don't let anyone who hasn't successfully authenticated in some way into this resource". This is done using the following authorization configuration:

<authorization>
    <deny users="?" />
</authorization>
If you wanted to only allow certain users you could change to do the following instead:

<authorization>
    <deny users="*" />
    <allow users="jdoe, msmith" />
</authorization>
Another approach is to define roles (groups) and simply lock the resource down to a special role which you put the users who you want to access the resource into.

<authorization>
    <deny users="*" />
    <allow roles="My Service Users" />
</authorization>
 
Share this answer
 
v2
A article also posted on Code Project in a brief go through this article:-
WebService Authentication with UsernameToken in WSE 3.0[^]
 
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