HTTPS C#帖子? [英] HTTPS C# Post?
本文介绍了HTTPS C#帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图登录到一个HTTPS网站,然后导航到下载使用C#(它的一个xml报告)的报告?
I am trying to login to a HTTPS website and then navigate to download a report using c# (its an xml report) ?
我已成功登录通过Cookie /头等等OK - 但每当我浏览到的链接登录后,我的连接带我到注销页?
I have managed to login OK via cookies/headers etc - but whenever I navigate to the link once logged in, my connection takes me to the "logged out" page ?
任何人都知道什么会导致此?
Anyone know what would cause this ?
推荐答案
确保的CookieContainer 您用于登录的是你下载时使用同一个。实际的报告
Make sure the CookieContainer you use for your login is the same one you use when downloading the actual report.
var cookies = new CookieContainer();
var wr1 = (HttpWebRequest) HttpWebRequest.Create(url1);
wr1.CookieContainer = cookies;
// do login here with wr1
var wr2 = (HttpWebRequest) HttpWebRequest.Create(url2);
wr2.CookieContainer = cookies;
// get the report with wr2
这篇关于HTTPS C#帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文