Search code examples
c#asp.netwebmethod

Prevent to invoke webmethod


I have bunch of webmethod in my site.Is there any way to check its call from my application or its directly call to invoke , out from my application.

I try this in web.config:

<webServices>
      <protocols>
        <remove name="HttpGet"/>
        <remove name="HttpPost"/>
        <remove name="HttpPostLocalhost"/>
      </protocols>
</webServices>

Its only prevent to invoke method but open my .asmx file in browser.My plan is to check whether its call from my application or direct browse ? If its direct browse then I have to prevent it to open ? Is there any secure way to do this or I am in wrong way?Thanks.


Solution

  • What you are looking for is called "authentication". You need to decide who your caller is.

    You would then provide "authorization" - making sure that only those callers who are permitted access to the service, actually have access.