.NET WebService Custom Attribute

Posted by DownChapel on Stack Overflow See other posts from Stack Overflow or by DownChapel
Published on 2010-04-23T14:18:11Z Indexed on 2010/04/23 14:53 UTC
Read the original article Hit count: 435

Filed under:
|
|

I would like to add a custom attribute to a asmx web service to determine if the request is valid based on the client IP address. This is a similar idea to the AuthorizeAttribute in ASP.NET MVC.

Is there anywhere (e.g. a HTTP module) I can put the code to look at the attribute on the webservice and decide whether to allow the request or not?

In my web.config the handler for asmx is the ScriptHandlerFactory from the System.Web.Extensions dll.

I have already implemented the functionality with a HTTP module and a config file with a list of allowed URLs, but I would prefer to get rid of the config file and just add an attribute to the webservice class.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about webservice