return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //HttpStatusCode statusCode 枚举 // HttpStatusCode.BadRequest = 400, public HttpStatusCodeResult(HttpStatusCode statusCode);//带参的构造函数 HttpStatusCodeResult 构造函数名 public HttpStatusCodeResult(HttpStatusCode statusCode) : this(statusCode, (string) null) { //调用两个参数的构造函数 } //传递400,(string)null; public HttpStatusCodeResult(int statusCode, string statusDescription) { this.StatusCode = statusCode; //400 this.StatusDescription = statusDescription; //null 空对象 } /// <summary>获取 HTTP 状态代码。</summary> /// <returns>HTTP 状态代码。</returns> public int StatusCode { get; private set; } /// <summary>获取 HTTP 状态说明。</summary> /// <returns>HTTP 状态说明。</returns> public string StatusDescription { get; private set; } //返回400界面或者404界面或其他界面
原文地址:https://www.cnblogs.com/enych/p/8252523.html
时间: 2024-11-10 07:33:03