需要在HttpWebResponse中访问HttpOnly cookie

编程入门 行业动态 更新时间:2024-10-26 06:27:56
本文介绍了需要在HttpWebResponse中访问HttpOnly cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

解决方案

Hello binazhar,

欢迎到开发环球Windows应用论坛!

请阅读粘贴帖子,尤其是 发布指南:主题行标签和 Windows 10 SDK和工具的已知问题

请记得在标题中添加标签。

HTTPOnly由服务器在设置cookie时提供,表明客户端脚本不应该看到cookie,其中包括用于通过CookieManager获取cookie的C#代码。当客户端在后续请求中将cookie重新发送到服务器时,客户端不会将其发送回服务器。

您必须在下次请求之前手动将缺少的Cookie添加到CookieContainer。

代码如下:

Cookie Cookie = new Cookie(" Name"," value"); cookie.Secure = true; cookie.Domain =" www.xxxxxxx" ;; cookieContainer.Add(cookie);

最好的问候,

Xavier Eoro

解决方案

Hello binazhar,

Welcome to the Developing Universal Windows apps forum!

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools

And please remember to add tag to title.

HTTPOnly is provided by the server when it is setting a cookie to indicate that the cookie should not be visible to client side script, which includes our C# code to fetch the cookies through the CookieManager. The client will not send it back to the server when it resends the cookie to the server on subsequent requests.

You would have to manually add the missing cookie to the CookieContainer before next request.

The code as the following:

Cookie cookie = new Cookie( "Name","value"); cookie.Secure = true; cookie.Domain = "www.xxxxxxx"; cookieContainer.Add(cookie);

Best Regards,

Xavier Eoro

更多推荐

需要在HttpWebResponse中访问HttpOnly cookie

本文发布于:2023-11-24 12:22:21,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:HttpWebResponse   HttpOnly   cookie

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!