q**1 发帖数: 193 | 1 httpd.conf 里面:
ErrorDocument 404 /error.html
我现在希望在 error.html 里面动态加上request URL地址,
例如我 Server 是:
http://example.com
我访问任意一个不存在的网页,例如:
http://example.com/dir/non_exist.html
我需要在 error.html 里面显示该 request 的 URI
/dir/non_exist.html
而不是 /error.html,该如何动态实现?? //bow |
q**1 发帖数: 193 | 2 Eventually, I 've figured this out at comp.lang.perl.misc
Just wondering how PHP|JSP|.NET guys handle the similar
situation if anybody doesnt care to share any thought. my
mod_perl code is like:
my $url = $r->prev->unparsed_uri();
【在 q**1 的大作中提到】 : httpd.conf 里面: : ErrorDocument 404 /error.html : 我现在希望在 error.html 里面动态加上request URL地址, : 例如我 Server 是: : http://example.com : 我访问任意一个不存在的网页,例如: : http://example.com/dir/non_exist.html : 我需要在 error.html 里面显示该 request 的 URI : /dir/non_exist.html : 而不是 /error.html,该如何动态实现?? //bow
|
c*****t 发帖数: 1879 | 3 我觉得你思考的方法很有问题。既然发现了有人有办法解决问题,
如果你想知道具体怎么做的,第一想法就应该是看源码。二就是反
推。既然有人做出来,那么肯定是 server 在执行那个程序的时候
传递了该信息。那么看下 server 的说明。
【在 q**1 的大作中提到】 : httpd.conf 里面: : ErrorDocument 404 /error.html : 我现在希望在 error.html 里面动态加上request URL地址, : 例如我 Server 是: : http://example.com : 我访问任意一个不存在的网页,例如: : http://example.com/dir/non_exist.html : 我需要在 error.html 里面显示该 request 的 URI : /dir/non_exist.html : 而不是 /error.html,该如何动态实现?? //bow
|
q**1 发帖数: 193 | 4 我是新手当然希望先知道有经验人士的想法,什么东西都自己推导出来固然很好,但是
在这个信息化的社会里,时间是很重要的。要是先有个头绪(特别从有经验人士那里的
经验)可能会使我少走很多弯路,这就是我的想法。。我这个问题在USENET上那人没答
对,不过他给我那个链接倒是让我学了不少东西,呵呵。。。
【在 c*****t 的大作中提到】 : 我觉得你思考的方法很有问题。既然发现了有人有办法解决问题, : 如果你想知道具体怎么做的,第一想法就应该是看源码。二就是反 : 推。既然有人做出来,那么肯定是 server 在执行那个程序的时候 : 传递了该信息。那么看下 server 的说明。
|
c*****t 发帖数: 1879 | 5 没有自己思考过的知识不是自己的知识。
【在 q**1 的大作中提到】 : 我是新手当然希望先知道有经验人士的想法,什么东西都自己推导出来固然很好,但是 : 在这个信息化的社会里,时间是很重要的。要是先有个头绪(特别从有经验人士那里的 : 经验)可能会使我少走很多弯路,这就是我的想法。。我这个问题在USENET上那人没答 : 对,不过他给我那个链接倒是让我学了不少东西,呵呵。。。
|
q**1 发帖数: 193 | 6 知识共享的社会,不是盲从的社会,更不是闭门造车的社会,同学。
我在问你问题的时候当然自己也在思考实践测试,不过如果我能从外面发现
更好的option,当然不会拒绝。只不过表达的方式有所差异而已,,呵呵
【在 c*****t 的大作中提到】 : 没有自己思考过的知识不是自己的知识。
|
l*****a 发帖数: 166 | 7 JSP, ASP.net can use session, I think. They all have application events that
can be triggered then you can store the original request in session; it is
possible that the request object is automatically passed which includes URL
information but I cannot remember too much.
【在 q**1 的大作中提到】 : httpd.conf 里面: : ErrorDocument 404 /error.html : 我现在希望在 error.html 里面动态加上request URL地址, : 例如我 Server 是: : http://example.com : 我访问任意一个不存在的网页,例如: : http://example.com/dir/non_exist.html : 我需要在 error.html 里面显示该 request 的 URI : /dir/non_exist.html : 而不是 /error.html,该如何动态实现?? //bow
|
q**1 发帖数: 193 | 8 The problem is when accessing /error.html, the request object has been
passed to /error.html. this is finished in an earlier Apache server
phase. So in my HTML::Mason code, the Mason request object returned is
/error.html. to get the previous request handler, I have to use Apache
request object, mod_perl somehow fills that space by tracking the
whole Apache request sequence..:) I have not yet touch any seesion
related stuff, and will read and hope it can reach a better solution :-)..
Anyway, the
【在 l*****a 的大作中提到】 : JSP, ASP.net can use session, I think. They all have application events that : can be triggered then you can store the original request in session; it is : possible that the request object is automatically passed which includes URL : information but I cannot remember too much.
|
r****y 发帖数: 26819 | 9 要是IIS,这问题很简单。
【在 q**1 的大作中提到】 : httpd.conf 里面: : ErrorDocument 404 /error.html : 我现在希望在 error.html 里面动态加上request URL地址, : 例如我 Server 是: : http://example.com : 我访问任意一个不存在的网页,例如: : http://example.com/dir/non_exist.html : 我需要在 error.html 里面显示该 request 的 URI : /dir/non_exist.html : 而不是 /error.html,该如何动态实现?? //bow
|
q**1 发帖数: 193 | 10 能不能大概说下 IIS 如何重定向 404 Error Responses?
或者指点一个比较初级,reasonable的link。。
虽然从来没用过,扫下盲也好。呵呵 //bow
【在 r****y 的大作中提到】 : 要是IIS,这问题很简单。
|
r****y 发帖数: 26819 | 11 http://www.i386.info/notfound.htm
I think with apache there's similiar setting.
【在 q**1 的大作中提到】 : 能不能大概说下 IIS 如何重定向 404 Error Responses? : 或者指点一个比较初级,reasonable的link。。 : 虽然从来没用过,扫下盲也好。呵呵 //bow
|
q**1 发帖数: 193 | 12 very intersting, the GUIs make things much clearer. :-)
many thanks //bow
【在 r****y 的大作中提到】 : http://www.i386.info/notfound.htm : I think with apache there's similiar setting.
|
q**1 发帖数: 193 | 13
BTW. this link actually does not say how to add
dynamic contents into the custom error page
/nonfound.htm. I guess it still needs something like
session(mentioned in a previous post, I've not yet
gotten a chance to try it myself though) or other
things like the mod_perl request handler.
Setting ErrorDocument in Apache is as easy
and flexible as IIS, the only difference is we
usually don't use GUI stuff. hehe
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
【 】 Ctrl-Q 求救 状态 [插入][5,22][ ][ ] 时间【Fri Apr
【在 r****y 的大作中提到】 : http://www.i386.info/notfound.htm : I think with apache there's similiar setting.
|
q**1 发帖数: 193 | 14 I am recently reading some papers about sessions, and got some
questions for you if you dont mind I ask:
as per my understanding, I usually save seesion information
in my server side with (memory|file|database), and query them
through an unique session-id or URI. But when I issue a wrong
URL of my website, I dont know (how|where) to define these seession
ID or any unique thing to save/fetch session info, coz of an obvious
reason that the whole request is redirect before the
content ge
【在 l*****a 的大作中提到】 : JSP, ASP.net can use session, I think. They all have application events that : can be triggered then you can store the original request in session; it is : possible that the request object is automatically passed which includes URL : information but I cannot remember too much.
|