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

G

Guest

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 the code for the Webclient retrieve:

Dim myWebClient As New WebClient
myWebClient.Credentials = CredentialCache.DefaultCredentials

' Create a new NameValueCollection instance to hold the QueryString
parameters and values.
Dim myQueryStringCollection As New NameValueCollection

'Assign the report interface to the query string
myQueryStringCollection.Add("IBIF_ex", "TW_allocation.fex")
'Assign the variables and values for the report
myQueryStringCollection.Add("IA_STATUS", "F")
myQueryStringCollection.Add("IA_PUBLICIND", "N")
myQueryStringCollection.Add("IA_DATERANGE", "TODAY")
myQueryStringCollection.Add("IA_FROMDATE", Today())
myQueryStringCollection.Add("IA_TODATE", Today())

' Attach QueryString to the WebClient.
myWebClient.QueryString = myQueryStringCollection
Dim myDatabuffer As Byte() = myWebClient.DownloadData(WFRptURL)

' RETURN the downloaded data.
Dim download As String = Encoding.ASCII.GetString(myDatabuffer)
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!
 

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

Top