写ASP风格cookie的使用JavaScript(带钥匙);读取使用传统的ASP [英] Write ASP-style cookie (with keys) using Javascript; read using classic ASP

查看:100
本文介绍了写ASP风格cookie的使用JavaScript(带钥匙);读取使用传统的ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在经典的ASP,一个cookie可以是名称/值对的集合。例如,一个名为Cookie集合用户可以创建有按键,其中包含有关用户的信息:

In Classic ASP, a single cookie can be a collection of name/value pairs. For instance, a cookie collection named "user" could be created to have keys which contains information about a user:

("user")("firstname")="John"
("user")("lastname")="Smith"
("user")("country")="Norway"
("user")("age")="25"

是否可以编写使用Javascript那种饼干,让ASP会识别它,并据此分析它?

Is it possible to write that kind of cookie using Javascript, so that ASP would recognize it and parse it accordingly?

推荐答案

应该是可行的。

您的ASP例子将使一个Cookie,将类似于此:

Your asp example would make a cookie that would look similar to this:

Name:   user
Value:  firstname=John&lastname=Smith&country=Norway&age=25

所以,当你设置你的JavaScript饼干应该是类似的格式,你可以试试:

so when you set your javascript cookies it should be a similar format, try something like:

document.cookie = "user=firstname=John&lastname=Smith&country=Norway&age=25;";

这篇关于写ASP风格cookie的使用JavaScript(带钥匙);读取使用传统的ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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