如何保护 ASP.NET Web 服务仅允许相对路径调用?
我的 Web 应用程序有 ASMX 服务,我只希望该服务可用于同一应用程序。
有没有办法让Web服务只能被同一个应用程序访问,例如相对/绝对路径限制?
I have ASMX services for my web application that I would only like available to the same application.
Is there a way for the web service to only be accessible by the same application, such as relative/absolute path restrictions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法就是不使用网络服务。如果您从同一个应用程序进行调用,您可能只需将逻辑提取到一个单独的类中,然后直接在代码中调用它,而不是通过 Web 服务。
The easiest route would be to just not use a web service. If you're calling from the same application, you can probably just pull your logic into a separate class, and call it directly in your code, not via web service.
有两种方法可以实现此目的:
Two ways to do this:
Web 服务可以由各种代码调用,而不仅仅是网站一部分的代码。因此,一般来说,不存在“调用 URL”。
Web services can be called by all sorts of code, not just code that's part of a web site. So, in general, there is no "calling URL".