Custom Messages For 'Un-Trappable' Errors?

Z

ziondreams

There seem to be errors that are "un-trappable" through web service
code as asp.net simply outputs it's own error message to the page when
they occur. For example,

Let's say I've got the following simple web service in C#:

[WebMethod]
public string testOne(string input)
{
return input;
}


Now, if I attempt to call testOne() without providing an input
parameter, I get the following message in my browser:

Missing Parameter: input

Is there anyway to "trap" this error and present my own custom error to
the user?

Other examples of errors I would like to trap include:
--Sending a SOAP envelope to the webservice that is malformed. I know
this sounds odd, but I would like to return a custom error instead of
simply a 500 error.
--I'm sure there's more but that's all that I can think of for now.
Thanks,
Kyle
 
D

Dilip Krishnan

Hello ziondreams,

You would need to create a new httpmodule to handle errors or use the
global.asax to trap those errors If I remember right its the handler for
application error (Application_Error in the asax)
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top