Webbrowser Parameters

D

dwm

I have what I know must be a very simple question and if I knew what the
correct terms were, I could probably find this myself.

I'm using ASP.NET 2.0 and Visual Basic .Net 2008. I have created a web site
on a remote server. I have created a Windows application than contains a
windows form with a webbrowser control. I want to pass some parameters from
the windows form via the webbrowser control to the website's .aspx file. I'm
pretty sure I'm passing the information correctly to the .aspx file, but how
in the world do I get my hands on the information once it's there? I'm
trying to populate a text box with the information I passed in.

If you don't know the answer, but know what it's called that I'm trying to
do, I'd appreciate that answer too!

Any help would be greatly appreciated.

Thanks in advance.
 
D

dwm

Sorry about that...
Here's the code that sends the info to the web page - or at least that's
what I think it does.


Public Overloads Sub ShowDialog(ByVal key As String)
Dim vPost As Byte()
Dim vHeaders As String
Dim ParamName As String
Dim cPostData As String

ParamName = "KEY"
cPostData = ParamName & key

vHeaders = "Content-Type: application/x-www-form-urlencoded" +
Chr(10) + Chr(13)
vPost = ASCIIEncoding.ASCII.GetBytes(cPostData)
Me.WebBrowser1.Navigate("http://www.myweb.com/info.aspx", Nothing,
vPost, vHeaders)
MyBase.ShowDialog()
End Sub
 
B

bruce barker

unfortunately the webbrowser is com based so accessing its content is
not as easy as from vb/c++. there is a simple wrapper routine exposed as
the HtmlDocument property you can use to access the browsers dom. the
example don't show it but you should use use Marshal.ReleaseComObject or
you will have huge memory leaks.

-- bruce (sqlwork.com)
 
D

dwm

huh?

I don't think I want to access the webbrowser control at all once I've made
the call to the server. All I want is to populate a field in the .asp page
from input parameters entered into the URL that shows up in the webbrowser
control...
 
G

Gregory A. Beamer

If you can append the values to the URL, you can pull them from the
querystring. The method is fairly simple:

1. Create the URL to place in the web browser control.
2. Add "?" to the url string
3. Add each populated value in the form "value1=value"
4. Call the URL

On the ASPX side, you simple do something like:

string value1 = Request.QueryString["value1"];

You can also mimic a POST instead of a GET, if that is what you are aiming
for.

If this does not make any sense at all, Google GET and POST to understand
how web pages are pulled from a server.

NOTE: A better way to interact with the web from a windows form is to set up
a SOA implementation with web services (WCF or ASMX).
 
D

dwm

Thank you, thank you, thank you!

That's the exact information I was looking for!

Gregory A. Beamer said:
If you can append the values to the URL, you can pull them from the
querystring. The method is fairly simple:

1. Create the URL to place in the web browser control.
2. Add "?" to the url string
3. Add each populated value in the form "value1=value"
4. Call the URL

On the ASPX side, you simple do something like:

string value1 = Request.QueryString["value1"];

You can also mimic a POST instead of a GET, if that is what you are aiming
for.

If this does not make any sense at all, Google GET and POST to understand
how web pages are pulled from a server.

NOTE: A better way to interact with the web from a windows form is to set
up a SOA implementation with web services (WCF or ASMX).


dwm said:
I have what I know must be a very simple question and if I knew what the
correct terms were, I could probably find this myself.

I'm using ASP.NET 2.0 and Visual Basic .Net 2008. I have created a web
site on a remote server. I have created a Windows application than
contains a windows form with a webbrowser control. I want to pass some
parameters from the windows form via the webbrowser control to the
website's .aspx file. I'm pretty sure I'm passing the information
correctly to the .aspx file, but how in the world do I get my hands on
the information once it's there? I'm trying to populate a text box with
the information I passed in.

If you don't know the answer, but know what it's called that I'm trying
to do, I'd appreciate that answer too!

Any help would be greatly appreciated.

Thanks in advance.
 
G

Gregory A. Beamer

Glad I could help.


dwm said:
Thank you, thank you, thank you!

That's the exact information I was looking for!

Gregory A. Beamer said:
If you can append the values to the URL, you can pull them from the
querystring. The method is fairly simple:

1. Create the URL to place in the web browser control.
2. Add "?" to the url string
3. Add each populated value in the form "value1=value"
4. Call the URL

On the ASPX side, you simple do something like:

string value1 = Request.QueryString["value1"];

You can also mimic a POST instead of a GET, if that is what you are
aiming for.

If this does not make any sense at all, Google GET and POST to understand
how web pages are pulled from a server.

NOTE: A better way to interact with the web from a windows form is to set
up a SOA implementation with web services (WCF or ASMX).


dwm said:
I have what I know must be a very simple question and if I knew what the
correct terms were, I could probably find this myself.

I'm using ASP.NET 2.0 and Visual Basic .Net 2008. I have created a web
site on a remote server. I have created a Windows application than
contains a windows form with a webbrowser control. I want to pass some
parameters from the windows form via the webbrowser control to the
website's .aspx file. I'm pretty sure I'm passing the information
correctly to the .aspx file, but how in the world do I get my hands on
the information once it's there? I'm trying to populate a text box with
the information I passed in.

If you don't know the answer, but know what it's called that I'm trying
to do, I'd appreciate that answer too!

Any help would be greatly appreciated.

Thanks in advance.
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top