?
Solved

Internet Explorer Web Browser Control Embedded

Posted on 2003-03-03
15
Medium Priority
?
687 Views
Last Modified: 2008-03-10
I am developing an application which primarily is built using vb.net, but takes advantage of the web browser control and shdocvw.dll.

I am using the Navigate2 Method to take me to a url. Now the problem I have is passing data collected by the VB application into the web control.

I have tried passing through the query string which originally worked, but compromises security within the application. As a result I tried to use something called
"navNoHistory" but to no real success.

I have also looked at the "PostData" section of the Navigate Method, but still have no luck. I am pretty much a beginner on .Net and running out of ideas on how to get this data through to my web page and web application.

I need a solution that will not allow the user to view posted data either through their browser history etc. Can somebody help as this is really taking time and I need to get this movng as soon as possible.

Thank You.
0
Comment
Question by:hospidium
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 1

Expert Comment

by:SeanGraflund
ID: 8058129
if you turn off viewstate for the page you are redirecting too, you can access the values passed using Request.Form,
like in old asp and post pages.  
0
 
LVL 1

Author Comment

by:hospidium
ID: 8058338
Sean,

I am using the web browser control in vb.net and cold fusion as the scripting for the page. Once I have the data that I require to the web page I can take over with the cold fusion from there.

The key thing here is that the data is not seen by the user. The URL cannot be added to the history when navigation is complete. Is there code for this?
0
 
LVL 1

Expert Comment

by:SeanGraflund
ID: 8058379
If you can post the form collection with the redirect, then you should be set ..

Example:

Response.Redirect("Page.cmf", true);

Then with the cold fusion page, just use the equivalent to Request.Form["objectname"] to get each value ..
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 1

Author Comment

by:hospidium
ID: 8058464
Sean,

Do you have a code example of how I could acheive the whole process. Sorry don't quite understand at the moment.

Thanks
0
 
LVL 1

Expert Comment

by:SeanGraflund
ID: 8058528
basically, the redirect method with that true parameter passed would send the entire form items collection with the redirect .. thus, you wouldn't have to use QueryStrings

Say for instance, you have a page with the following:

<form>
<asp:textbox id="text1" runat=server></asp:textbox>
<asp:textbox id="text2" runat=server></asp:textbox>

<asp:button id="cmdGoToColdFusionPage" runat=server text="Go"></asp:button>
</form>

now,

in the code behind for the button you'd do the following .. I don't think you'd need the dll at all that you are using .. you can do this completely in code ..

private void cmdGoToColdFusionPage_Click(object sender, System.EventArgs e)
{
   Response.Redirect("ColdFusionPage.cfm", true);
}


Then, in your cold fusion page, you can access everything through the forms collection like you would in old asp .. I'm not familiar how to do that in cold fusion, but in old asp you'd access it like the following:

Request.Form("text1")
Request.Form("text2")
0
 
LVL 1

Author Comment

by:hospidium
ID: 8058592
Sean,

Here is the code that is being used.

me.ax1webbrowser.navigate2("url", flags, targetframe, postdata, headers)


Now in the URL I can pass the query string as well but that will be stored in the browser history, where values can be accessed. I am looking for a solution that will ideally stop this from happening or erase the history when the application exits, not using ASP. Remember that the application is a vb.net application with an embedded web browser activex control, using the shodcvw.dll library.

That is the solution I am looking for. Sorry If I did not make myself cler in the first place.

If someone can provide a solution using this method then that will be great! Thanks for your help so far
0
 
LVL 1

Expert Comment

by:SeanGraflund
ID: 8058689
i think the parameter you need to pass is postdata, if you can somehow pass the forms collection to the postdata parameter, it will work ..
0
 
LVL 1

Author Comment

by:hospidium
ID: 8058933
I have done this Sean and have no results. Any ideas? How I would construct the string etc. or some sample code for this.
0
 
LVL 1

Expert Comment

by:SeanGraflund
ID: 8058951
you should just be able to send it Request.Form
0
 
LVL 1

Author Comment

by:hospidium
ID: 8063654
this is not the solution I am looking for. Does every variable have to be specified when using the navigate or navigate2 method?

I want o really use the post data section of Navigate method. How would I get the data that I have into the postdata section of navigate and what format does it have to be? (e.g. string, object etc.)

It cannot be just string or object because the variables are not being passed. What can it be and how is it done?
0
 
LVL 1

Author Comment

by:hospidium
ID: 8070351
Can nobody answer this question? Surely this has been done before?
0
 
LVL 2

Expert Comment

by:Hummusx
ID: 8084147
I'm working on exactly the same problem.  If I can figure it out I will most definitely post my results here.  Sean doesn't quite grasp what is going on I don't think, since he keeps referring to server side ASP.NET stuff.

I've tried making a list of parameters and the converting it to a Byte array (the data type of the postdata parameter), but didn't have any luck.  I wasn't actually sure how to handle multiple parameters, or even what the format for a single parameter should be.  I am very surprised at how much documentation there ISN'T for this control.

Anyway, I'll update you if I figure out how to do it.
0
 
LVL 1

Author Comment

by:hospidium
ID: 8086856
Thanks HummusX. I have been searching everywhere for this solution yet there are no examples of how to acheive this. Let me know if you have anything and likewise I will do the same. Thanks
0
 
LVL 1

Author Comment

by:hospidium
ID: 8087070
HummusX and anybody else who needs to know. I have solved my problem. This is how I got round it...

 Private Enum BrowserNavConstants
        navOpenInNewWindow = 1
        navNoHistory = 2
        navNoReadFromCache = 4
        navNoWriteToCache = 8
        navAllowAutosearch = 10
        navBrowserBar = 20
        navHyperlink = 40
    End Enum

Dim BteArray() as Byte
Dim Url as String
Dim vHeaders As String = "Content-Type: application/x-www-form-urlencoded" + Chr(10) + Chr(13)

Ok so that is the variables declared. Now we use the navigate2 or navigate method below...

url = "http://www.xxxxxxxxxxx.com/index.cfm"
BteArray = System.Text.Encoding.ASCII.GetBytes("username=xxx&password=yyy&answer=hjhjh")

'The System.Text.Encoding.ASCII.GetBytes was the namespace that does the work for us so after, our final navigation statement looks like below'

Me.WebBrowser.Navigate2(url,BrowserNavConstants.NavNoHistory,System.DBNull.Value,BteArray,vHeaders)

This will then complete the navigation and post the form data with it that you have collected in your application. Hope this helps people as I have been stuck on this problem for ages!!! and now it's solved!!

0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 8267312
User resolved; points refunded and question closed.

Netminder
EE Admin
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question