Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the HTTP response status code from ASMX Web Service

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

Now with asmx Web Services, I'm not really sure where I'd put this logic in. I know I'm definitely not interested in writing an ISAPI Filter, and I'm not really running in the ASP.NET environment so HTTPModule is probably useless to me as well.

Any suggestions. Would running this in WCF provide me a simpler mechanism for setting this on a web service?

like image 986
taudep Avatar asked Oct 23 '25 15:10

taudep


1 Answers

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

Also, I'm not sure, but Global.asax event handlers are executed even with web service requests, so you may be able still to use what you want there.

like image 90
Sunny Milenov Avatar answered Oct 25 '25 04:10

Sunny Milenov