473,408 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

webBrowser and autodownload file

Hi,

Please direct me if this is the wrong group to ask.

I'm writing a c# program to visit website and autodownload files that
may be prompted.
For example, I visit http://www.mytestwebsite.com and the page will
prompt with a somefile.csv. I would like my program to autodownload
whatever maybe the file and then parse it for info I'm interested.

My code is

webBrowser.Navigate("http://mytestwebsite.com");

I'm stuck here because after that, the browser will pop out a window to
ask to save the file. How to make the poping of window go away
automatically and directly store and parse the file?

A million thanks.

Sep 6 '06 #1
2 2941
Instead of doing this through the web browser, you should use the
HttpWebRequest and HttpWebResponse classes. They will allow you to download
the content of the site without having to deal with a user interface.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ka*****@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,

Please direct me if this is the wrong group to ask.

I'm writing a c# program to visit website and autodownload files that
may be prompted.
For example, I visit http://www.mytestwebsite.com and the page will
prompt with a somefile.csv. I would like my program to autodownload
whatever maybe the file and then parse it for info I'm interested.

My code is

webBrowser.Navigate("http://mytestwebsite.com");

I'm stuck here because after that, the browser will pop out a window to
ask to save the file. How to make the poping of window go away
automatically and directly store and parse the file?

A million thanks.

Sep 6 '06 #2
Thank you.
I used HttpWebRequest and HttpWebResponse and it works. But the result
is not consistent. The problem is beating the wits out of me and
appreciate any advise.

When I tried websiteA, I am able to get the download working.
When I tried websiteB, I am unable to get the download working.
The error is
//
An unhandled exception of type 'System.Net.WebException' occurred in
System.dll
Additional information: The underlying connection was closed: An
unexpected error occurred on a receive.
//

If I run the same program at different location (e.g.in my office vs.
at home), at times both websiteA and websiteB works, yet at times only
websiteA works.

I have not have any success in locating the cause of the above error.

Could it be something special about the network at different location?
or what could be the other possible cause? Any pointers are much
appreciated.
Nicholas Paldino [.NET/C# MVP] wrote:
Instead of doing this through the web browser, you should use the
HttpWebRequest and HttpWebResponse classes. They will allow you to download
the content of the site without having to deal with a user interface.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ka*****@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,

Please direct me if this is the wrong group to ask.

I'm writing a c# program to visit website and autodownload files that
may be prompted.
For example, I visit http://www.mytestwebsite.com and the page will
prompt with a somefile.csv. I would like my program to autodownload
whatever maybe the file and then parse it for info I'm interested.

My code is

webBrowser.Navigate("http://mytestwebsite.com");

I'm stuck here because after that, the browser will pop out a window to
ask to save the file. How to make the poping of window go away
automatically and directly store and parse the file?

A million thanks.
Sep 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TD | last post by:
Hi, I have a problem with the autodownload function for the Java JRE download. Problem is that users with java version 1.4.2 installed do not update to version 1.5.0. I created my autodownload...
2
by: Matthias Huening | last post by:
Hi, os.startfile('http://www.python.org') works fine on WinXP with IE as default webbrowser. With Mozilla Firefox 0.9 as default webbrowser, however, I get an error. Firefox starts, the page...
7
by: Mustafa Rabie | last post by:
Hi All, I want to add autodownload like all the one in Downloads.com. When u click download now link it redirects you to a page that the file downloads the application after the page is loaded....
19
by: Blair P. Houghton | last post by:
I'm just learning Python, so bear with. I was messing around with the webbrowser module and decided it was pretty cool to have the browser open a URL from within a python script, so I wrote a...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
2
by: Ryan Ramsey | last post by:
I have been chasing this one down for a week and have narrowed it down to a machine issue. I have the following code: webBrowser.Navigate(http://finao.net/post_dkp.php?database=40); Basically...
5
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
8
by: Dustan | last post by:
At http://docs.python.org/whatsnew/modules.html on the webbrowser module, it says "A number of additional browsers were added to the supported list such as Firefox, Opera, Konqueror, and elinks." ...
4
by: Gregory Bloom | last post by:
I'm running Python 2.5 under Windows. If I fire up IDLE and enter: it works like a champ, opening the page in Firefox. Same thing goes from a Windows cmd shell: it works as advertised. But...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.