Ash
Ash

Reputation: 798

Retrieving webmethod parameter values from Application_BeginRequest or Application_EndRequest

Is there a way to retrieving parameter names and values passed to a web method from Request object? I've read somewhere that you need extra code to access the soap body. Any known workarounds to be able to see the soap body from Application_BeginRequest? Thanks!

Upvotes: 0

Views: 1202

Answers (2)

Mahdi Mashayekhi
Mahdi Mashayekhi

Reputation: 21

If these events fired in this case you can read the xml content of the request by calling :

Request.InputStream.Read(...);

and then :

 Request.InputStream.Seek(0, SeekOrigin.Begin);

to reset the InputStream location.

Upvotes: 2

John Saunders
John Saunders

Reputation: 161801

ASMX web services do not use the full ASP.NET pipeline. I don't believe that these two events even fire for a web service.

To access the SOAP data stream, you want to implement a SoapExtension.


Of course, I should also take this opportunity to remind readers that Microsoft now considers ASMX web services to be a "legacy technology". They suggest that all new web service development should use WCF.

Upvotes: 1

Related Questions