Problems with SoapExceptions in custom HttpModule

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,
I wrote a custom HttpModule for my ASP.NET XML web service so that I could
do custom user authentication via SOAP headers. I have this working except
for one problem: When I throw SoapExceptions from my HttpModule, the
response is sent back to the client as html instead of xml.

This results in the client throwing an exception that the content type is
'text/html', not 'text/xml':
"Client found response content type of 'text/html; charset=utf-8', but
expected 'text/xml'."

If I throw a SoapException from the web service code itself, it works fine.
Unfortunately, the HttpModule has more information about the error, and I
really don't want to enter the web service code if the user is not
authenticated - e.g. I would like to throw an exception!

Anyone know why this might happen? Do I have to write my own custom SOAP
envelope code or something?

Thanks,
cj


.



Relevant Pages

  • Re: How to have a "fault" element in generated WSDL?
    ... That being said, as you know, Web service exceptions are raised as SOAP ... message class representation to inherit from the SoapException class. ... throw a custom SoapException class then you should be able to capture the ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • RE: Best way to monitor online user activity?
    ... HttpModule should be a good approach. ... handler that process the request. ... you can create a custom httpmodule and configure it behind ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: NavBar customization
    ... You could try to put some custom code into the NavBar which calls a ... custom web service to get the HTML showing the web site list. ... other code change can be done in the web service later if required. ... > to the navbar for existing webs. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Problems with namespaces
    ... I have several classes that will be used in different parts of the application and web service. ... you found that the client app report error about the custom class ... the client-side proxy will also generate ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Stumped - Strongly Typed Arrays question (with simplified code example)
    ... class that encapsulates the custom array type. ... But, in the same context of using the web service versus remoting, I ... array manipulation methods as a web service simply because that allows ... Windows Forms client all use the same manipulation methods) and to ...
    (microsoft.public.dotnet.framework.aspnet.webservices)