How to detect which web service protocol an ASP.NET request is using?

1.8k Views Asked by At

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.

3

There are 3 best solutions below

0
On BEST ANSWER

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.

0
On

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.

2
On

Look in Request.ServerVariables, specifically the SERVER_PROTOCOL variable.

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