HighTechTalks DotNet Forums  

Re: WebBrowser.Document.ExecCommand / SaveAs / vista, ignores parameters

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


Discuss Re: WebBrowser.Document.ExecCommand / SaveAs / vista, ignores parameters in the Dotnet Framework (WinForms Controls) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Sheng Jiang[MVP]
 
Posts: n/a

Default Re: WebBrowser.Document.ExecCommand / SaveAs / vista, ignores parameters - 12-28-2007 , 03:57 PM






This is a secuity limit
Since you are hosting the control, you can parse the page for the target URL
and make another web request to download the file.

--
Sheng Jiang
Microsoft MVP in VC++
"Lucvdv" <name (AT) null (DOT) net> wrote

Quote:
I'm using a webbrowser control on vista to programmatically save files
from the web.

I'm trying to use the WebBrowser.Document.ExecCommand function with
the SaveAs command, as documented in

http://msdn2.microsoft.com/en-us/lib...8VS.85%29.aspx

[I replaced ( and ) in the URL by %28 and %29 because my news agent
doesn't seem to support links with those characters]


This results in something like

: br2.Document.ExecCommand("SaveAs", False, DownloadPath)

This works, but the last two arguments are ignored.

The "save as" dialog always pops up even though I tell it not to, and
the initial path is in My Documents.

I replaced \ by \\ in the path as indicated in the docs, but whether I
do or don't doesn't make any difference.


Could this be a (security or other) setting in IE, or does IE7/Vista
simply not work as documented in MSDN?


Or perhaps you can give a hint to help solve my original problem: I
had to resort to a WebBrowser because the site where I'm downloading
from is secured, and when I use a HTTPWebRequest I get some html code
asking me to log on instead of the image, even when I'm already logged
on to the site through a webbrowser control in the same app.

Using the logon functionality in the HTTPWebRequest doesn't work
because the site uses a PHP form for logging on.

Using a second WebBrowser instead of a HTTPWebRequest solved that
problem, but now I'm stuck on those save dialogs.



A lot of work for an application that will be used only once, but the
alternative is clicking "save target as" and confirming the download
location in a standard web browser hundreds of times.



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.