在Windows应用程序中下载文件 [英] Download file in Windows application

查看:148
本文介绍了在Windows应用程序中下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用C#.net构建Windows应用程序,我想从服务器下载文件.
如果该文件在HttpWebRequest的帮助下直接存在,我可以下载.我的问题是下载不是直接过程,而是一个三步过程
1.登录到应用程序(从中下载文件)
2.将网址重定向到另一页以接受条款和条件
3.现在再次重定向到所需的URL以下载文件.

我已在Windows应用程序启动时登录到Web应用程序.我可以使用此登录会话中的cookie

请帮助实现第2步和第3步.

谢谢,

Hi,

I am working on a windows application build in C# .net and I want to download a file from server.
I am able to download if the file is directly present with help of HttpWebRequest. The problem I have is that the download is not a direct process its a three step process
1. Login to the application (from where the file is to be downloaded)
2. redirect the url to another page to accept terms and conditions
3. now again redirect to the desired url to download the file.

I have logged into the web application on the windows application launch. I can use the cookies from this logged in session

Please help in achieving the step 2 and step 3.

Thanks,

推荐答案

要接受第二个页面,您应该首先使用GET使用登录名返回的相同cookie来获取它.
然后,您可能应该发布[accept]
最终,您将能够获得所需的URL

您可以使用 fiddler [
To accept the second page you should first get it using a GET using the same cookie returned by login.
Then you should probably post the [accept]
Finally you''ll be able to get the desired URL

you can use fiddler[^]to record all those request and it will help you to make the same request in your C# program.


这篇关于在Windows应用程序中下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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