过期链接的http状态代码?

时间:2011-05-17 08:33:53

标签: http

伙伴们,这是一段在一定时间内到期的链接的正确状态代码?

我原本打算在到期后发送404,但也许有更好的http状态要发送。

链接示例:

mysite/dir/062011/file.exe(< - 仅在06-2011之间工作)

由于

3 个答案:

答案 0 :(得分:53)

410“走了”怎么样? 请参阅:http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

答案 1 :(得分:17)

410 Gone

The requested resource is no longer available at the server and no forwarding
address is known. This condition is expected to be considered permanent.

答案 2 :(得分:-1)

当我尝试在C#Web API中验证过期的验证码时,我花了410英镑。我使用REST API指南作为参考https://www.restapitutorial.com/httpstatuscodes.html

    /// <summary>
    /// Verify email address
    /// </summary>
    /// <param name="verificationCode">Verification Code for ownership of an email address</param>
    /// <returns>Verify Email Update Api Response</returns>
    [HttpPut]
    [Route("{verificationCode}/verify-email-update")]
    [ResponseType(typeof(VerifyEmailChangeApiResponse))]
    public async Task<IHttpActionResult> VerifyEmailUpdate(Guid verificationCode)
    {
        var response = await this.emailVerificationService
            .VerifyEmailUpdate(verificationCode)
            .ConfigureAwait(false);

        switch (response.Result)
        {
            case VerifyEmailUpdateApiResultType.Ok:
                return this.Ok(response);

            case VerifyEmailUpdateApiResultType.EmailAddressAlreadyVerified:
                return this.Content(HttpStatusCode.Conflict, response);

            case VerifyEmailUpdateApiResultType.Expired:
                return this.Content(HttpStatusCode.Gone, response);

            case VerifyEmailUpdateApiResultType.UnknownProblem:
                return this.Content(HttpStatusCode.BadRequest, response);
        }

        return this.Ok(response);
    }