Out Select Case WeekDay(dt,1) Case 1:Out="Sun" Case 2:Out="Mon" Case 3:Out="Tue" Case 4:Out="Wed" Case 5:Out="Thu" Case 6:Out="Fri" Case 7:Out="Sat" End Select engWeekDayName = Out End Function Function engMonthName(dt) Dim Out Select Case Month(dt) Case 1:Out="Jan" Case 2:Out="Feb" Case 3:Out="Mar" Case 4:Out="Apr" Case 5:Out="May" Case 6:Out="Jun" Case 7:Out="Jul" Case 8:Out="Aug" Case 9:Out="Sep" Case 10:Out="Oct" Case 11:Out="Nov" Case 12:Out="Dec" End Select engMonthName = Out End Function %> 然后在具体的页面中,比如index.asp和news.asp的“最上面”加入以下代码:HTTP Header <!--#include file="../include.asp"--> <% '页面将被设置20分钟后过期 SetExpiresHeader(20) %>
应用的缓存兼容性设计
经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。但是在转发请求的HTTD头信息中,增加了HTTP_X_FORWARDED_????信息。用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址。 下面是2个例子,用于说明缓存兼容性应用的设计原则:
function getHostName () dim hostName as String = "" hostName = Request.ServerVariables("HTTP_HOST") if not isDBNull(Request.ServerVariables("HTTP_X_FORWARDED_HOST")) then if len(trim(Request.ServerVariables("HTTP_X_FORWARDED_HOST"))) > 0 then hostName = Request.ServerVariables("HTTP_X_FORWARDED_HOST") end if end if return hostNmae end function
//对于一个需要记录客户端IP的PHP应用:不要直接引用REMOTE_ADDR,而是要使用HTTP_X_FORWARDED_FOR, function getUserIP (){ //注意这个函数中的¥字符是PHP的美元符号 ¥user_ip = ¥_SERVER["REMOTE_ADDR"]; if (¥_SERVER["HTTP_X_FORWARDED_FOR"]) { ¥user_ip = ¥_SERVER["HTTP_X_FORWARDED_FOR"]; } }
上一页 [1] [2] |