在Safari浏览器中保存cookie [英] saving cookie in safari browser

查看:1170
本文介绍了在Safari浏览器中保存cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一个Web项目,它的第一页是登录页,在用户登录后,我将用户名保存在cookie中.
当我在Safari浏览器中对其进行测试时,我发现Cookie一直都是null.

因此,如果Safari不支持保存Cookie或存在解决方案?

任何帮助...

感谢

hi all
i have a web project , the first page of it is login page , which after user login , i save user name in a cookie .
when i tested it in safari browser, i found the cookie is null all time.

So, if safari doesn''t support saving cookie or there is a solution ??

Any Help...

Thanks

推荐答案

,您只是在编写Cookie,并且无法控制站点读取/显示要放入URLDecode的值,您还可以执行以下操作:

you are just writing the cookie and do not have control over the site reading/displaying the value to put in the URLDecode you can also do something like this:

ckCookie.Value = (Server.HtmlEncode( strSpecialCharacters )).Replace(";","");


这将确保在cookie中设置完整的字符串,即使不使用; Safari,Chrome,Firefox和IE仍将识别html代码.并且读取时不需要解码.

有关Cookie规范的详细答案,请参见:
http://stackoverflow.com/questions/1969232/allowed-characters-in-cookies/1969339#1969339 [ ^ ]


This will ensure the full string is set in the cookie and Safari, Chrome, Firefox and IE will still recognize the html codes even without the ; and does not require decoding when read.

For a longer answer on cookie specs see:
http://stackoverflow.com/questions/1969232/allowed-characters-in-cookies/1969339#1969339[^]


这篇关于在Safari浏览器中保存cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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