如何在asp.net中阅读跨域cookie? [英] How to read cross domain cookies in asp.net?
本文介绍了如何在asp.net中阅读跨域cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的网站上阅读跨域Cookie。我有两个应用程序,如https://dev.com和https://sample.com。我想在https://sample.com上从https://dev.com服务器读取cookie。以下代码是阅读语言。
<前lang =cs> 如果(请求。 Cookies [ GUEST_LANGUAGE_ID]!= null )
{
Response.Write(Request.Cookies [ GUEST_LANGUAGE_ID ]。值);
}
else {Response.Write( No lang); }
但 GUEST_LANGUAGE_ID cookie值为空。如何阅读任何人帮助我的价值。
提前谢谢。
解决方案
你不能。阅读发给其他域名的cookie是不可能的 - 这应该是一个巨大的安全漏洞......
I want to read cross domain cookies in my site. I have two applications like https://dev.com and https://sample.com. I want to read cookie from https://dev.com server in https://sample.com. The below code is to read language.
if (Request.Cookies["GUEST_LANGUAGE_ID"] != null)
{
Response.Write(Request.Cookies["GUEST_LANGUAGE_ID"].Value);
}
else{ Response.Write("No lang"); }
But the GUEST_LANGUAGE_ID cookie value is null. How to read the value anybody help me.
Thanks in advance.
解决方案
You can not. Reading cookies issued to other domains is impossible to read - that should be a huge security flaw...
这篇关于如何在asp.net中阅读跨域cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文