需要在HttpWebResponse中访问HttpOnly cookie [英] Need to access HttpOnly cookie in HttpWebResponse

查看:151
本文介绍了需要在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.com" ;;
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.com";
            cookieContainer.Add(cookie);

Best Regards,

Xavier Eoro


这篇关于需要在HttpWebResponse中访问HttpOnly cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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