473,406 Members | 2,293 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,406 software developers and data experts.

WebBrowser access to binary content

I am trying to access the binary data of PDFs in my C# .NET 2.0
project. I have a URL that points directly to the PDF, but when I tell
my WebBrowser to retrieve it, it stalls and never finishes downloading
the document. I can't use an HttpWebRequest to get the PDF from this
URL, because the server that the PDF is hosted on requires script-based
authentication, which means I need to use a WebBrowser to do everything.
The authentication is no problem (I already have it logging in); I just
need to have my already logged-in WebBrowser fetch these PDFs without
any human interaction. How can I access the PDF without stalling?

Jun 27 '06 #1
7 10195
Hello,

Can you open ths PDF document directly in IE on the client? WebBrowser is
almost like an IE instance. To open a PDF document in IE, IE will first
download it in temp folder and then run Adobe Arcobat component, which may
be the root cause of the problem. So we may first try it in IE to see if it
can work.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 28 '06 #2
Yes, if I access the URL directly in IE it opens it in Acrobat.

I'd be happy if I could get the WebBrowser to save it as a local file with a
known name.

"Luke Zhang [MSFT]" wrote:
Hello,

Can you open ths PDF document directly in IE on the client? WebBrowser is
almost like an IE instance. To open a PDF document in IE, IE will first
download it in temp folder and then run Adobe Arcobat component, which may
be the root cause of the problem. So we may first try it in IE to see if it
can work.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 29 '06 #3
Can you open a PDF file in local disk, for example:

webBrowser1.Navigate("c:\\test.pdf");

Also, webBrowser didn't provide method Save() or SaveAs(), I think we still
need user interaction for save such a PDF file.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 30 '06 #4
That behaves the same as when I try to pull it from a remote location. The
browser stalls forever waiting for the document to complete.

It's fine if I can't save the PDF to disk; I really just need access in my
C# program to the binary stream.
"Luke Zhang [MSFT]" wrote:
Can you open a PDF file in local disk, for example:

webBrowser1.Navigate("c:\\test.pdf");

Also, webBrowser didn't provide method Save() or SaveAs(), I think we still
need user interaction for save such a PDF file.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 30 '06 #5
Hello,

With WebBrowser control, we also cannot get the stream of a PDF file. (Even
it has a property named "DocumentStream", but it is null value when loading
a PDF file in the webbrowser control. So, I think the proper should be with
HttpWebRequest. Would you please let know what the script-based
authentication is (maybe with cookies or something else)? Maybe we can find
a way with this.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 3 '06 #6
On these sites there's a form on the log-in page with some text fields to
fill out and a link to click that invokes a javascript submit. From there on
it's up to the scripts running on the page to remember that the agent is
logged in. And since the scripts are actually running inside the browser
agent, it's really more like the agent is remembering this for itself. There
seem to be no cookies involved; it's all maintained in the browser's state.
Which means, as far as I can tell, for a component to be capable of logging
in, it needs to be able to run these scripts and keep track of enough log-in
information to please the server.

Any chance we can get an HttpWebRequest to pull this off?

"Luke Zhang [MSFT]" wrote:
Hello,

With WebBrowser control, we also cannot get the stream of a PDF file. (Even
it has a property named "DocumentStream", but it is null value when loading
a PDF file in the webbrowser control. So, I think the proper should be with
HttpWebRequest. Would you please let know what the script-based
authentication is (maybe with cookies or something else)? Maybe we can find
a way with this.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 10 '06 #7
Hello,

If the authentication tolally on client side, we may simulate the last
request to the server. I suggest you may trace the request, for example,
with Fiddler ( you may google with this to get download link, a very great
tool!). With these trace, we can get the exact request message the client
sent ( after authentication on client), and then use HttpWebRequest, or
HttpRequest to send a same request.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 10 '06 #8

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

Similar topics

0
by: Noah Coad [MVP .NET/C#] | last post by:
How does one gain access to the WebBrowser (SHDocVw) control to the extent of the one used in VS.NET Start Page? I'm familiar with using the control directly, I've written a tutorial on it, and...
4
by: Randy | last post by:
Hi, ok, I found a way to connect to a running instance of an (external) Internet Explorer and access - for example - the html source. That works fine! But now I have running application with...
5
by: ask josephsen | last post by:
Hi NewsGroup Hope you can help me with this. I'm using the "System.Windows.Forms.WebBrowser" to display a various markuplanguage. And it works fine pointing the "WebBrowser.Url" to a local or...
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...
8
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: Robson Siqueira | last post by:
Folks, I am facing a problem. I am trying to manipulate the HTML data (thru the Document and DocumentText properties) of the WebBrowser object (System.Windows.Forms). The problem is that the...
7
by: - Electronic.HR - | last post by:
I have very strange and stupid problem with .NEt's webBrowser control... If I do this: ---------------------------------- private void btnGoogle_click(object sender, EventArgs e) { ...
2
by: M R | last post by:
i am writing an application (C#) that automates the process of loading a web page, login into a site and then simulates the navigation of the site. the program uses a winform with a webBrowser...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.