代码之家  ›  专栏  ›  技术社区  ›  Jeff Dege

返回HTTP 403.7 HTTPResponseMessage

  •  0
  • Jeff Dege  · 技术社区  · 7 年前

    如果您正在实现自己的authorizeAttribute,并且重写handleUnauthorizedRequest,则将httpActionContext.Response设置为httpResponseMessage。

    httpResponseMessage构造函数将httpStatusCode枚举的实例作为参数。

    此枚举包含常见顶级HTTP代码的值:

    • httpstatuscode.ok=200
    • httpstatuscode.notfound=404
    • 等。

    有一个值httpstatuscode.Forbidden=403。但没有403.7的值-需要客户端证书。或者,就这一点而言,任何其他子代码。

    如何返回子代码错误?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Jeff Dege    7 年前