如何在Windows应用程序中使用WebBrowser控件下载文件。 [英] How to Use WebBrowser Control in Windows Application to Download Files.

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

问题描述

HI


我已经开发了一个网站,

有一个登录页面。

用户名和登录凭证被携带通过网站。

我在网站上有下载页面。

文件的名称和ID显示在GridView中。

用户选择一个特定的ID,然后单击下载按钮。

然后它重定向写入下载脚本的页面,打开保存文件窗口,用户可以将文件保存到任何他想要的位置,页面重定向

返回到具有文件列表的同一页面。



现在,我想在Windows应用程序中集成此下载页面。

为此,我使用webBrowser控件。

在表单加载时我正在使用该网站的URL加载Webbrowser控件。

I已经设法将凭据从Windows传递到Web登录页面。

然后导航到下载页面。

下一步我选择要下载的文件并单击页面中的下载按钮。我没有在表单中放置任何下载按钮。我只是在WebBrowser控件中打开页面并执行相同的操作。



但是当我点击下载按钮时,Internet Explorer窗口在应用程序外部打开,可能是因为页面正在重定向到另一个URL。在这里它松开所有登录凭据,不允许我下载文件。



有没有办法可以下载Web浏览器控件和文件中的页面重定向仅在Windows应用程序内部。



我在下载按钮单击事件上使用了JavaScript,该事件将获取所选文件ID,然后重定向到下载脚本页面。 />


如何在应用程序内下载文件。

请协助。>

解决方案

看看这个网站......



http://social.msdn.microsoft.com/Forums/vstudio/en-US/64a51959 -f187-4736-97e0-8944dd1b059d / how-to-download-file-from-the-internet-to-my-computer-vbnet-windows-aplication?forum = vbgeneral



或者...



http://msdn.microsoft.com/en-us/library/ez801hhe%28v=vs.110%29。 ASPX

HI
I have Developed a website ,
Having a login page.
The username and Login Credentials are carried through out the website.
I have Download Page within the website.
The Name and IDs of the Files are Shown in a GridView.
The user Selects a particular ID and then Clicks the Download Button.
Then It redirects the page where the Download Script is Written, Save File Window opens and user can save the File wherever he wants to,page Redirects
back to the Same page having the List of the Files .

Now Here I want to Integrate this Download page in a windows Application.
For this I am using a webBrowser Control.
On Form Load I am loading the Webbrowser Control with the URL of that website.
I have managed to pass the credentials from windows to the web login page.
And then Navigates to the Download Page.
Next when I Select the File to Download and Click the Download button within the Page.I have not Placed any Download Button in my Form. I am Just Opening the Page in the WebBrowser Control and Doing the Same thing.

But When I am Clicking the Download Button ,Internet Explorer window Gets Open Outside the Application,may be due to that The Page is redirecting to another URL. and here its Loosing all the login Credentials and not allowing me to Download the Files.

Is there any way so that Page redirects within the Webbrowser Control and File can be downloaded inside the windows application only.

I Have used JavaScript on the Download button click event which is fetching the Selected File ID and then redirecting to the Download Script page.

How can I download the File within Application itself.
Please assist.>

解决方案

Have a look at this site...

http://social.msdn.microsoft.com/Forums/vstudio/en-US/64a51959-f187-4736-97e0-8944dd1b059d/how-to-download-file-from-the-internet-to-my-computer-vbnet-windows-aplication?forum=vbgeneral

Or...

http://msdn.microsoft.com/en-us/library/ez801hhe%28v=vs.110%29.aspx


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

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