404与自定义错误页面? [英] 404 versus custom error page?

查看:92
本文介绍了404与自定义错误页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些CGI程序在用户输入

非法表单输入时吐出错误页面。这些自定义错误页面在通知用户

错误的同时,只是标准网页。


是否存在不吐出404错误的缺点?我假设404不仅仅是另一个网页,而是带有一个错误

发生的信息 - 以这么简单的方式可以使用它例如链接

查询。


TIA,


S

I have some CGI programs that spit out error pages when the user enters
illegal form input. These custom error pages, while informing the user of
errors, are otherwise just standard web pages.

Is there a disadvantage to not spitting out a 404 error? I assume 404 isn''t
just another webpage, but carries with it the information that an error
occured---in so simple a manner that it could be used for e.g. link
checking.

TIA,

S

推荐答案

sinister写道:
sinister wrote:
[snip]




404是一个HTTP标头,应该在找不到文件时发送。我认为你的错误页面有不同的含义。

-

Anne van Kesteren

< http ://www.annevankesteren.nl/>



404 is a HTTP header, which should be sent when a file can''t be found. I
think your error page has a different meaning.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>




" sinister" < SI ****** @ nospam.invalid>在消息中写道

新闻:eA *************** @ nwrddc02.gnilink.net ...

"sinister" <si******@nospam.invalid> wrote in message
news:eA***************@nwrddc02.gnilink.net...
我有一些CGI当用户输入非法表格输入时吐出错误页面的程序。这些自定义错误页面在通知用户错误的同时,也只是标准的网页。

没有吐出404错误是否有缺点?我假设404
不仅仅是另一个网页,而是带有错误发生的信息 - 以这么简单的方式可以用于例如链接
检查。
I have some CGI programs that spit out error pages when the user enters
illegal form input. These custom error pages, while informing the user of
errors, are otherwise just standard web pages.

Is there a disadvantage to not spitting out a 404 error? I assume 404 isn''t just another webpage, but carries with it the information that an error
occured---in so simple a manner that it could be used for e.g. link
checking.




HTTP状态代码就是 - HTTP状态代码。他们告诉浏览器

其资源的HTTP请求(页面,图像文件,等等)的结果,

如:


资源是否按要求退回(200)

浏览器是否需要在其他地方寻找它所要求的

资源(客户 - 侧面重定向,302)


浏览器是否需要进行身份验证

才能提供页面(401)


认证是否失败(403)

URL是否指不存在的资源(404)


在你的情况下,你问的是*应用*错误。没有

* HTTP *错误:服务器正确找到了您请求的资源,毕竟,
是确定表单的资源(网页)输入

很糟糕。在这种情况下要返回的正确HTTP状态代码是200.



HTTP status codes are just that--HTTP status codes. They tell the browser
the outcome of its HTTP request for a resource (page, image file, whatever),
such as:

whether the resource is being returned as asked (200)

whether the browser needs to look elsewhere for the
resource it requested (a client-side redirect, 302)

whether the browser needs to be authenticated
before the page will be provided (401)

whether authentication has failed (403)

whether the URL refers to a non-existent resource (404)

In your situation, you are asking about an *application* error. There was no
*HTTP* error: the server correctly found the resource you requested, which
is, after all, the resource (web page) that determined that the form input
was bad. The correct HTTP status code to be return in this situation is 200.


sinister写道:
sinister wrote:
我有一些CGI程序在用户输入非法表单输入时吐出错误页面。这些自定义错误页面在通知用户错误的同时,也只是标准的网页。

没有吐出404错误是否有缺点?我假设404
不仅仅是另一个网页,而是带有发生
错误的信息 - 以如此简单的方式可以用于例如链接
检查。
I have some CGI programs that spit out error pages when the user enters
illegal form input. These custom error pages, while informing the user of
errors, are otherwise just standard web pages.

Is there a disadvantage to not spitting out a 404 error? I assume 404
isn''t just another webpage, but carries with it the information that an
error occured---in so simple a manner that it could be used for e.g. link
checking.




404表示发生了_specific_错误,即无法找到所请求的资源

。 br />

您最好为

生成的错误选择相应的错误消息。

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html


-

David Dorward< http://dorward.me.uk/>



404 says a _specific_ error has occurred, i.e. that the requested resource
could not be found.

You would be better of picking the appropriate error message for the
generated error.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

--
David Dorward <http://dorward.me.uk/>

这篇关于404与自定义错误页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆