473,725 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10209
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.Nav igate("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.Nav igate("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
720
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 am familiar with HTML Applications (HTA), but how are features like the right-click context sensitive menu and selection diabled in VS.NET's Start Page? If I attempt to make a WebBrowser control navigate to an HTA file, it brings up a dialog...
4
2885
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 an embedded IE webBrowser Control. Is there a possibility for my application to access the webBrowser control in the other application, too? Thanks in advance, Randy
5
2893
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 remote uri. But what I would actually like to do, is to download a webpage as a string, analyze it, possibly modify it, and then display it on the WebBrowser - without asking the WebBrowser to download it again. By the "HttpWebRequest" I can easily...
12
6375
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 of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
8
3417
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
5571
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
13358
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 application enters in a loop state and my changes don't apply. Have somebody faced the same problem? Any solutions?
7
18707
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) { webBrowser1.Navigate(http://www.google.com);
2
8563
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 control that is used to load the web page. i am able to successfully navigate the site but am having trouble entering data into the fields. the two fields are the username and password. i would like to automatically enter the username and password...
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.