如何在c#中使用http 1.1 4xx 5xx错误进行应用程序响应?
答案 0 :(得分:4)
使用相应的HttpException
投放HttpStatusCode
。
http://msdn.microsoft.com/en-us/library/system.web.httpexception.aspx
http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode.aspx
示例:
throw new HttpException((int) HttpStatusCode.NotImplemented, "Requested function not supported");