Urgent: Integrate WebBrowser Control in ASP.NET/VB.NET?

A

ASP .NET Newbie

How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use
the WebClient to get the page data, but I need to be able to use the
WebBrowser (AxWebBrowser)?

Thanks,

Chad
 
K

Kyril Magnos

You could host it as an ActiveX object. But, only IE users will be able to
view it and with XP-SP2 coming out, ActiveX controls are going to be very
difficult to deal with.

Why not try using a server-side IFrame or a JavaScript window.open()?

HTH,

Kyril
 
A

ASP .NET Newbie

I need to run it within the ASP .NET (VB .NET) in the code behind, nothing
on the client...

Chad
 
K

Kyril Magnos

Ok, well, using the WebBrowser control, even in code behind, is going to A)
be huge tax on resources, and B) doesn't make sense. The System.Net classes
can deal with grabbing content from virtually any network recourse that you
can think of. Perhaps you can elaborate a bit on what you are trying to
accomplish with the WebBrowser control and I might be able to give you a
better answer. :)

Kyril
 
A

ASP .NET Newbie

I am going to use it to "capture" an image of a web page. I can't use the
WebClient (as far as I know) to capture/create an image of a remote wep
page. I know there are components to do this for you out there, I need to
figure out how to do this myself.

Thanks!

Chad
 
K

Kyril Magnos

Hi Chad,

When you say "capture an image of a web page", are you referring to
something of a screen shot? If this is the case, you are spinning your
wheels. What you want to do is either use WebClient or
WebRequest/WebResponse to capture the actual HTML of the page (otherwise
known as "scraping"). Then, once you have the original HTML, you can do with
it as you please. You can store it, save it, display it in an IFrame or
Frame or whatever else you want to do. WebBrowser is not capable of doing
this.

The WebBrowser control is really more for WinForms and displaying HTML and
not for use in WebForms. Because it is an ActiveX control, it has a huge
overhead in terms of resources (Interop is expensive). Also, when you create
it in code-behind, there isn't much that you can do to actually get the HTML
of the source page that you would want to navigate to and capture. (Things
like the HTML DOM and such is not easily exposed from the WebBrowser
control). This is where the System.Net classes really excel. They were
designed for this sort of thing.

I would strongly recommend revaluating what you need to do and see if you
can do it using the native .NET classes as opposed to using ActiveX
controls. Even a server side IFrame would be 100x better than trying to use
the WebBrowser control.

HTH,

Kyril
 
S

Scott G.

Take a look at this:

http://www.gotdotnet.com/Community/...mpleGuid=836c770f-89eb-4041-ba7c-ff870a57cca1

It's in the form of a webservice; but should should be able to adapt it to web page image.

Scott
I am going to use it to "capture" an image of a web page. I can't use the
WebClient (as far as I know) to capture/create an image of a remote wep
page. I know there are components to do this for you out there, I need to
figure out how to do this myself.

Thanks!

Chad
 
A

ASP .NET Newbie

Thanks for the feedback guys. I don't need to capture the "contents" of the
page, I need an actual "screen shot" of the page. The posting from Scott G.
is what I'm looking for, except I can't use a web service (development
restrictions) and I can't use any third party components. All development
for this has to be "in-house".

Ideas?

Chad
 
S

Scott G.

The link I sent is source code; download it and just grab the imaging part out.... if I recall this isn't more than 10s of lines of code.

Scott
Thanks for the feedback guys. I don't need to capture the "contents" of the
page, I need an actual "screen shot" of the page. The posting from Scott G.
is what I'm looking for, except I can't use a web service (development
restrictions) and I can't use any third party components. All development
for this has to be "in-house".

Ideas?

Chad
 
B

bruce barker

its pretty complicated. the webservice example given uses the system shell
object to generate a thumbnail, not what you want.

anyway here is the standard approach (not high performance)

1) create a .net wrapper around the IE web control.
2) create a print driver that writes a bitmap to disk
2) load the url into the control (will have to poll or sync to the load)
3) tell the control to print to your driver (will need to poll again)
4) pick up the output of your driver

-- bruce (sqlwork.com)
 
Joined
Sep 28, 2007
Messages
1
Reaction score
0
How to use webbrowser control to asp.net application

Hi.

I would like to ask the same question. I need to develop a web application with custom log in controls (txtUsername, txtPassword, btnSubmit) but will log me in to yahoo mail. I think the webbrowser control can do this. My problem is, it has to be a web application. Is there a way to do so with or without using WebBrowser control?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top