469,963 Members | 1,890 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

MS Web Browser + .NET - File download dialog problem.

Hello all!

I'm writing a simple C# application, that should day by day open a
particular web site and download a text file (new file is generated by
the server daily).

I'm using Microsoft Web Browser ActiveX, and I cannot simply provide
the file URL in my app, because of:

1) First, I should provide credentials to enter the site
2) I should execute a script to generate a page containing list of
files
3) I should parse a page to find a link to the particular file (file
URL)

So far I succeeded with all these steps and this is what I'm actually
having problem with:

When I execute Navigate method on a file url, the file download dialog
appears. I don't need the dialog, but unfortunately don't know how to
skip it, just download the file and save it to some folder.

For now I'm using another approach - fortunately the web site provides
the way to view the content of file inside a web page, so I'm loading
the page an grabbing its contents... But I don't like this anyway.

Any help appreciated.

May 1 '06 #1
3 1887
Use a HttpWebRequest object to get the page instead.

Uncle_Bob wrote:
Hello all!

I'm writing a simple C# application, that should day by day open a
particular web site and download a text file (new file is generated by
the server daily).

I'm using Microsoft Web Browser ActiveX, and I cannot simply provide
the file URL in my app, because of:

1) First, I should provide credentials to enter the site
2) I should execute a script to generate a page containing list of
files
3) I should parse a page to find a link to the particular file (file
URL)

So far I succeeded with all these steps and this is what I'm actually
having problem with:

When I execute Navigate method on a file url, the file download dialog
appears. I don't need the dialog, but unfortunately don't know how to
skip it, just download the file and save it to some folder.

For now I'm using another approach - fortunately the web site provides
the way to view the content of file inside a web page, so I'm loading
the page an grabbing its contents... But I don't like this anyway.

Any help appreciated.

May 1 '06 #2
I'm not sure it could be done this way, as there's an authentication
procedure I mentioned above. If I would ask server for the file url
directly, it will come up with HTTP 403 and redirect me to the login
page.

May 2 '06 #3
You can pass authentication information through either webrequest or
webclient.

See the WebRequest.Credentials property
http://msdn2.microsoft.com/en-us/lib...ls(VS.80).aspx

Cheers,

Greg
"Vladimir Zinchenko" <vz********@inbox.ru> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I'm not sure it could be done this way, as there's an authentication
procedure I mentioned above. If I would ask server for the file url
directly, it will come up with HTTP 403 and redirect me to the login
page.

May 2 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jason | last post: by
1 post views Thread by RN1 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.