Loosing cookie when swich from http to https

ⅰ亾dé卋堺 提交于 2020-01-05 06:49:26

问题


I have the option in my site to change language.

When user change language ,its saved in cookie, so the other pages know which language to display!

Some of the pages are in https. And in these pages I don't get the selected language.

Is there any way to use the same cookie for http and https?


回答1:


No, there isn't. The cookies are local to the domain, and the http and https pages are considered to be in different domains.

The https pages are encrypted, so sending the same cookies for a http request would leak that information, and compromise the encryption.




回答2:


You could try setting your cookie to secure = false

see http://msdn.microsoft.com/en-us/library/system.web.httpcookie.secure.aspx

how can I share an asp.net session between http and https



来源:https://stackoverflow.com/questions/14315820/loosing-cookie-when-swich-from-http-to-https

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!