如何删除Cookie中的langauge属性 [英] how to delete langauge attribute inside cookie

查看:96
本文介绍了如何删除Cookie中的langauge属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想在浏览器中替换cookie的旧属性语言值时,它可以在本地服务器中工作,但是当我部署在实时服务器中时,它并不能用新值替换特定语言属性中的旧值.在两次添加相同语言属性的情况下,一次添加了新值,另一次则使用了旧值,浏览器考虑了旧值,因此在firefox3.5版本中网站的语言不会更改.您能提出您的建议吗?
在此先感谢您.

When i want to replace old attribute language values of cookie inside browser it''s working in local server but when i deployed on live server it''s not replacing the particular language attributes old value with new value.it''s adding same language attribute two times one with new value other with old value and browser consider old values so language doesn''t change for website in firefox3.5 versions.can you give yrour suggestion.
Thanks in advance.

推荐答案

向我们展示一些代码会有所帮助.我假设您正在服务器上执行此操作.

要替换cookie的值,您是否尝试过删除它,然后将其重新添加回新值?

Showing us some code would help. I''ll assume you''re doing this on the server.

To replace a cookie''s value have you tried removing it, then adding it back with the new value?

// Get the current outbound cookie so we can remove it and replace it with an update.
HttpCookie cookie = HttpContext.Current.Response.Cookies[key];
if (cookie != null)
    HttpContext.Current.Response.Cookies.Remove(key);

cookie = new HttpCookie(key);
cookie.Value   = value;
cookie.Expires = ...

HttpContext.Current.Response.Cookies.Add(cookie);


这篇关于如何删除Cookie中的langauge属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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