I have a windows forms client that consumes an ASP.net web service.
It's my understanding that when an exception is thrown by the web service it will be converted to a SoapException in the .net client software.
Well, I am catching the SoapException, but when I display the message on the client end in a messagebox, it shows more information than I really want to show.
Here is the webservice code:
throw new ApplicationException("Invalid username or password.");
Or even:
throw new SoapException("Invalid username or password.", SoapException.ServerFaultCode);
But on the client end, the SoapException's Message property is this:
System.Web.Services.Protocols.SoapException: Invalid username or password. at Transportation.InsertSignUps(String username, String password, SignUp[] signUps) in c:\Documents and Settings\rdoverby\My Documents\Visual Studio 2008\WebSites\www.gtcc.edu\App_Code\webservices\Transportation.cs:line 50
Whereas, all I really want to show is:
Invalid username or password.
How can I extract ONLY the original exception's message from the SoapException. I have poked around the SoapException object in the VS debugger, but I can't find what I am looking for.
Thanks.
EDIT
Of course, I don't want to parse that long string.