如何检测 ASP.NET 请求正在使用哪种 Web 服务协议?
我有一个 ASP.NET (1.1) Web 服务,它使用 SoapExtension.ProcessMessage(SoapMessage) 覆盖对客户端进行身份验证,如下所述:
http://www.codeguru.com/columns/experts/article.php/c5479
但是,如果 web.config 未设置为 HttpSoap 是唯一允许的协议,那么 ProcessMessage 将永远不会被其他协议上传入的请求调用,因此绕过了安全性。
是否有办法以编程方式确保使用 SOAP(而不是依赖 web.config 来确保其正确性)?
谢谢。
I have an ASP.NET (1.1) web service which authenticates clients using a SoapExtension.ProcessMessage(SoapMessage) override as described in:
http://www.codeguru.com/columns/experts/article.php/c5479
However if the web.config if not set up such that HttpSoap is the only protocol allowed, then ProcessMessage will never get called for requests coming in on other protocols, and therefore bypass security.
Is there anyway to programatically ensure SOAP is being used (as opposed to relying on the web.config to be correct)?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果它对任何人有任何用处,我最终检查:
这并不理想,但似乎可以解决问题。
If it's of any use to anyone, I ended up checking:
which isn't ideal but seemed to do the trick.
查看
Request.ServerVariables
,特别是SERVER_PROTOCOL
变量。http://www.aspcode.net/List-of-RequestServerVariables.aspx
Look in
Request.ServerVariables
, specifically theSERVER_PROTOCOL
variable.http://www.aspcode.net/List-of-RequestServerVariables.aspx
您可以尝试在启动时读取并解析 web.config,看看它是否按照您希望的方式设置。
You could try to read and parse the web.config at startup, to see if it's set the way you'd like it to be.