如何检测 ASP.NET 请求正在使用哪种 Web 服务协议?

发布于 2024-07-17 04:30:59 字数 429 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月依秋水 2024-07-24 04:30:59

如果它对任何人有任何用处,我最终检查:

Request.ServerVariables["HTTP_SOAPAction"] != null

这并不理想,但似乎可以解决问题。

If it's of any use to anyone, I ended up checking:

Request.ServerVariables["HTTP_SOAPAction"] != null

which isn't ideal but seemed to do the trick.

陈年往事 2024-07-24 04:30:59

查看 Request.ServerVariables,特别是 SERVER_PROTOCOL 变量。

http://www.aspcode.net/List-of-RequestServerVariables.aspx

Look in Request.ServerVariables, specifically the SERVER_PROTOCOL variable.

http://www.aspcode.net/List-of-RequestServerVariables.aspx

戏剧牡丹亭 2024-07-24 04:30:59

您可以尝试在启动时读取并解析 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文