<%
dim user
user= session("user")
if user="" then
user=Request.Cookies("user")
if user="" then
user=getuser()
Response.Cookies("user")=user
Response.Cookies("user").Expires=#January 01, 2036#
end if
end if
session("user")=userfunction getuser()
;
end function
%>
就是读写cookie,session
dim user
user= session("user")
if user="" then
user=Request.Cookies("user")
if user="" then
user=getuser()
Response.Cookies("user")=user
Response.Cookies("user").Expires=#January 01, 2036#
end if
end if
session("user")=userfunction getuser()
;
end function
%>
就是读写cookie,session
Cookie c = new Cookie("nnn", null);
//c.setDomain("sintal.cn");
c.setPath("/");
c.setMaxAge(7 * 24 * 60 * 60);
//MD5_hr md5hr = new MD5_hr();
//String md5EnCodePassword = md5hr.getMD5ofStr(password);
//U2LoginBo bo = new U2LoginBo();
String userID="中文";
String password = "111111";
String data = userID+"|"+password;
c.setValue(URLEncoder.encode(data,"UTF-8"));
//c.setValue(data);
response.addCookie(c);
//读Cookies
out.print("<br>");
Cookie[] cookies = request.getCookies();
if (cookies != null) {
if (cookies.length > 0) {
for (int i = 0; i < cookies.length; i++) {
Cookie requestcookie = cookies[i];
out.print("damain="+requestcookie.getDomain() + ",name="
+ requestcookie.getName());
out.print("<br>");
// 找到了登陆Cookie
if (requestcookie.getName().equals("nnn")) {
String userinfo = requestcookie.getValue();
String[] suaa = StringUtils.split(userinfo,"|");
out.print("★★finded HR Cookie了,uid=" + userinfo+"<br>");
for( int j=0 ;j<suaa.length;j++){
out.print("suaa["+j+"]=["+suaa[j]+"]");
String ttt = URLDecoder.decode(suaa[j],"UTF-8");
out.print("==>"+ttt+"<br>");
}
out.print("<br>");
// 删除此Cookie
requestcookie.setMaxAge(0);
response.addCookie(requestcookie);
}
}//end for
} //end if cookie.length>0
}
%>