HighTechTalks DotNet Forums  

Suppress Save Dialog in WebBrowser control

Dotnet Framework (WinForms Controls) microsoft.public.dotnet.framework.windowsforms.controls


Discuss Suppress Save Dialog in WebBrowser control in the Dotnet Framework (WinForms Controls) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
anand gothe
 
Posts: n/a

Default Suppress Save Dialog in WebBrowser control - 12-28-2007 , 07:08 AM






Hi,

I'm using the WebBrowser control (.NET 2.0) to login to a website and
download a file. I navigate to the login page of the website, then
programatically fill username and password to login. Then I navigate to the
URL of the file. It all works fine, but I get the IE Save Dialog box when I
navigate to the file URL.

Is there a way to suppress this Save Dialog and instead download the file to
a given location.

I know the WebClient class has a DownloadFile method, but I need to be
logged-in to the website in order to download (i.e need to have a valid
session). I don't think the WebClient or WebRequest will allow me to access
the home page and login before accessing the URL for the file.

Could you help?

- &



Reply With Quote
  #2  
Old   
Sheng Jiang[MVP]
 
Posts: n/a

Default Re: Suppress Save Dialog in WebBrowser control - 12-28-2007 , 03:53 PM






You can use WebClient or WebRequest to make multiple requests with the same
cookie container
To enable WebClient to use a cookie container you need to override the
GetWebRequest method, create a request that reuses the cookie container
between requests.

--
Sheng Jiang
Microsoft MVP in VC++
"anand gothe" <anandgothe (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I'm using the WebBrowser control (.NET 2.0) to login to a website and
download a file. I navigate to the login page of the website, then
programatically fill username and password to login. Then I navigate to
the
URL of the file. It all works fine, but I get the IE Save Dialog box when
I
navigate to the file URL.

Is there a way to suppress this Save Dialog and instead download the file
to
a given location.

I know the WebClient class has a DownloadFile method, but I need to be
logged-in to the website in order to download (i.e need to have a valid
session). I don't think the WebClient or WebRequest will allow me to
access
the home page and login before accessing the URL for the file.

Could you help?

- &





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.