Hide asmx web methods conditionally in C#

吃可爱长大的小学妹 提交于 2019-12-02 05:34:59

You can check the flag in your method and throw an exception if it's not set.

You can't really do this.

Your clients "see" the web methods because they are listed in the WSDL. The WSDL generation is fairly static - it is based on the [WebMethod] attributes on your methods. There is really no ability to remove items from the generated WSDL.

If you can switch to WCF, you will find this much, much, easier. In the meantime, you'll just have to use authorization - prevent some clients from calling some methods.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!