Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个提供各种搜索实用程序的 ASMX Web 服务。如果我的用户输入的搜索条件太少,我希望 Web 服务返回带有自定义消息的 HTTP 500。我该怎么做呢?由于浏览器内的操作能力,我不想处理客户端输入不足的问题。
HTTP 500 表示内部错误。抛出一个未处理的异常应该会给你一个 HTTP 500。
throw new Exception("Your error message");
但是,这样做可能不是一个好主意。
更好的方法是抛出 SOAP 错误。
如果你只是抛出任何Exception它会产生 HTTP 500 错误
Exception
throw new Exception();
I am currently attempting to add a listener to my button so that when it is clicked it loads what is in the 'textId' textfield into an html text above said textfield and button. This is so th