Webbrowser Parameters

  • Thread starter Thread starter dwm
  • Start date Start date
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.
 
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
 
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)
 
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...
 
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).

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
 
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).

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
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.
 
Glad I could help.

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
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).

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
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.
 
Back
Top