0

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.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
stovroz
  • 6,835
  • 2
  • 48
  • 59

3 Answers3

2

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.

stovroz
  • 6,835
  • 2
  • 48
  • 59
0

Look in Request.ServerVariables, specifically the SERVER_PROTOCOL variable.

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

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • Won't SERVER_PROTOCOL contain "HTTP/1.1" whether or not HttpSoap is in use? – stovroz Apr 23 '09 at 17:49
  • Yes. I misread the question and I'm used to just checking between http or https. You might still find the link helpful, but probably not as much as I'd hoped. – Joel Coehoorn Apr 23 '09 at 18:38
0

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.

John Saunders
  • 160,644
  • 26
  • 247
  • 397