473,769 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using the WebClient and the Web Browser control together in VB.Net

Here is my perplexing issue and I've looked EVERYWHERE for help (well almost
everywhere.... probably should have started here :))
I am using a Webclient to successfully retrieve a "downloadat a" string that
contains a fully formed HTML page from a CGI-based process on a Web server. I
need to use the Webclient because it a) allows me to specifiy credentials
and b) forms the query string in a very readable and maintainable fashion.
Here is the code for the Webclient retrieve:

Dim myWebClient As New WebClient
myWebClient.Cre dentials = CredentialCache .DefaultCredent ials

' Create a new NameValueCollec tion instance to hold the QueryString
parameters and values.
Dim myQueryStringCo llection As New NameValueCollec tion

'Assign the report interface to the query string
myQueryStringCo llection.Add("I BIF_ex", "TW_allocation. fex")
'Assign the variables and values for the report
myQueryStringCo llection.Add("I A_STATUS", "F")
myQueryStringCo llection.Add("I A_PUBLICIND", "N")
myQueryStringCo llection.Add("I A_DATERANGE", "TODAY")
myQueryStringCo llection.Add("I A_FROMDATE", Today())
myQueryStringCo llection.Add("I A_TODATE", Today())

' Attach QueryString to the WebClient.
myWebClient.Que ryString = myQueryStringCo llection
Dim myDatabuffer As Byte() = myWebClient.Dow nloadData(WFRpt URL)

' RETURN the downloaded data.
Dim download As String = Encoding.ASCII. GetString(myDat abuffer)
Return download

The problem: Now that I have this wonderful HTML string returned by the CGI
process, how do I get it to display in a Web Browser control on my Windows
Form?
There do not appear to be any methods or properties in the Web Browser
control (shdocvw.dll) that let me assign this string as a document to be
displayed in the browser window (or said differently, before I do a .Show()
on the browser control how do I tell it what to show?).

Also, I can't do a "navigate" method on the Web browser control (I think)
because I need to supply credentials to the Web Server (I haven't seen
anywhere where you can supply credentials with the Web browser control).
Im am using VS.Net 2003.
A lifetime of good karma to the person that can help me with this!
--
Thank You. Alan.
Sep 26 '05 #1
0 2466

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

Similar topics

9
708
by: Kueishiong Tu | last post by:
I am using webclient to retrieve data from a web site. How do I control the time-out of this request?
4
2303
by: brianinbox | last post by:
Hi, I've been trying to upload file using webclient.uploadfile method from my IIS webserver to an Apache webserver without any success. On the Apache server (server that receives the incoming file) I have a simple php script, getFile.php to receive the file. The script look like this: <?php $uploadDir = '/var/www/Incoming/'; $uploadFile = $uploadDir . $_FILES;
7
3942
by: Crirus | last post by:
Hi all! I use a webClient for requesting data from a server of mine. Should I worry about long ammount of data sent by server in the client side? Or, another way, should I send some kind of a terminator sign in the data in order to realise in the client that all data arrived? -- Ceers, Crirus
1
3118
by: Scampi | last post by:
Hi, I've been working on an application to do some 'scraping' of web content, using the WebClient class. I'm using code rather like the following.. Dim objWebClient As New WebClient Dim strURL As String = CType(URL, String) Dim aRequestedHTML() As Byte Dim objUTF8 As New UTF8Encoding
0
421
by: AlanF | last post by:
Here is my perplexing issue and I've looked EVERYWHERE for help (well almost everywhere.... probably should have started here :)) I am using a Webclient to successfully retrieve a "downloadata" string that contains a fully formed HTML page from a CGI-based process on a Web server. I need to use the Webclient because it a) allows me to specifiy credentials and b) forms the query string in a very readable and maintainable fashion. Here is...
0
1262
by: galan1971 | last post by:
Hello, I'm trying to post to a page on a remote server and retrieve the result page and all is working fine except for one thing, the images which are dynamically created on the remote server appear broken. Here is the code: WebClient webClient = new WebClient(); webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); byte response = webClient.UploadData(URL, "POST",...
4
2692
by: Michael Duclon | last post by:
Does anyone know how I might use the webclient class to navigate to a web page in a vb.net app, and then if a JavaScript popup appears from the web page I go to, read the message in it or content of it, then close it so I can continue on. I don't know how to reference the popup box or send a command to click the ok button to close it. Mike Duclon
1
6496
by: Mad Scientist Jr | last post by:
For some reason I can't get a WebClient to access an outside URL from behind our firewall. The code works when it runs outside the firewall. I turned on windows authentication in the web.config <authentication mode="Windows" /> and set up IIS to not allow anonymous access. My browser is set up to auto detect the proxy server, so IE/Firefox can access outside pages, so I added code to auto-detect the proxy server.
6
6141
by: =?Utf-8?B?U2FtZWVrc2hh?= | last post by:
Hi, I want to write a simple .net program to open a URL, fill in fields, and click on a button to submit it using .net 1.1 framework. Can someone help in suggesting the libraries I should use? I tried using javascript, however, I am not able to make javascript wait for the page to completely load, before trying to access and fill fields on the page. Hence resorted to .net, but not finding the right library to use.
0
9579
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
10199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
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
9979
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
9849
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5293
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
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.