System.Net.HttpWebRequest和Cookies [英] System.Net.HttpWebRequest and Cookies

查看:137
本文介绍了System.Net.HttpWebRequest和Cookies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用HttpWebRequest类将请求从我的BHO发送到服务器.但是似乎有一个问题.如何发送带有请求的浏览器cookie?

当我收到响应时,我不知道如何使用响应中的cookie来填充浏览器.

或者,也许存在用于跨域请求的更方便的类.

请帮助我找到解决方案.

I try to send a request from my BHO to the server using HttpWebRequest class. But there appears to be a problem. How can I send browser cookies with request?

And when I get a response I don''t know how to populate my browser with cookies from this response.

Or, perhaps, there exists more convenient classes for cross-domain requests.

Please help me to find a solution.

推荐答案

您将需要使用interop并调用wininet api.

InternetSetCookie函数 [ Pinvoke.net wininet.InternetSetCookie [
You would need to use interop and call wininet api.

InternetSetCookie Function[^]
Pinvoke.net wininet.InternetSetCookie[^]

This would still work for Internet Explorer.


这篇关于System.Net.HttpWebRequest和Cookies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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