Configuring an HTTP response status code from an ASMX web service

I know that with ASP.NET there is a global Application_EndRequest handler where I can change Context.Response.StatusCode and set it to 200, which is my desire.

Now with asmx Web Services I'm not quite sure where I would introduce this logic. I know that I am definitely not interested in writing an ISAPI filter, and I'm not very running in ASP.NET so the HTTPModule is probably useless for me.

Any suggestions. Did this run in WCF a simpler mechanism to install this in a web service?

+3
source share
1 answer

While I can’t imagine why you need it :), you can try using WebService.HttpContext.Response and set the status code there.

Also, I'm not sure, but Global.asax event handlers execute even with web service requests, so you can use what you want there.

+4
source

All Articles