Thats my question, I'm catching a few WCF exceptions on my client and the ProtocolException always has html code in its message.
Could I assume that will happen every time? For what I see the real good message comes in the inner exception, could I just discard the ProtocolException message and show the user the message from the inner exception?
Asked
Active
Viewed 1,147 times
1

sebagomez
- 9,501
- 7
- 51
- 89
-
If you receive HTML in a message, then you should _read_ the HTML to see what it says. It may be giving you the _reason_ for the ProtocolException. Reading the documentation of the ProtocolException class might also be a good idea. – John Saunders Jun 16 '09 at 04:36
-
that's what I'm doing now... what I don't know is if every ProtocolException WILL bring html code in its message – sebagomez Jun 16 '09 at 19:40
1 Answers
1
No, it doesn't always contain HTML in the message. Generally if there is HTML it's because the server your talking with (or through) hasn't understood (or blocked) the request, and has replied with an HTML explanation as to why. The message is useful for figuring out the problem.
Unfortunately that isn't the only time you'll see ProtocolExceptions, so you can't assume it will always contain HTML.

Adam
- 533
- 4
- 12
-
can you provide an example where a ProtocolException would not have html code in its message? – sebagomez May 04 '13 at 03:37
-
Set a bindings MessageEncoding to Mtom when configured for text - no html in inner exceptions message. – Adam May 08 '13 at 18:21