Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Internet Explorer Web Browser Control Embedded

Posted on 2003-03-03
15
Medium Priority
?
689 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
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

571 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