如何从 WCF 服务返回 HTTP 401?
最佳答案
如果您正在编写 REST 服务,则可以通过以下方式完成:
private IWebOperationContext context = new WebOperationContextWrapper(WebOperationContext.Current); // Get the context
context.OutgoingResponse.StatusCode = HttpStatusCode.Unauthorized; // Set the 401
关于http - 从 WCF 服务返回 401,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1968300/