|
-
Nov 8th, 2004, 08:31 AM
#1
Thread Starter
Hyperactive Member
WebBrowser control and cookies [RESOLVED]
I have an app that contains a WebBrowser control. The app navigates the WebBrowser to a login page, fills out the login form and submits it. That works fine.
The problem is, is that once I'm logged into the website in order to use a certain feature of it, it launches a second browser window which is, of course, Internet Explorer. I don't mind that it launches a second independent browser but I don't believe the cookies are moving to the new browser window and I'm prompted to log back in all over again. This happens on a couple of different sites.
Anyone have any ideas?
Last edited by Chris H; Nov 8th, 2004 at 11:58 AM.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
-
Nov 8th, 2004, 09:42 AM
#2
Fanatic Member
Hi,
I believe there was a thread like this one a couple of weeks back. If I recall well, he tried a lot but didn't solve the problem. The easiest solution I can come up with is not letting the Web Browser control open up a new window, but having the new URL launch in the control itself. Would that work for you?
Author for Visual Basic Web Magazine
-
Nov 8th, 2004, 10:33 AM
#3
Thread Starter
Hyperactive Member
Originally posted by TheVader
Hi,
I believe there was a thread like this one a couple of weeks back. If I recall well, he tried a lot but didn't solve the problem. The easiest solution I can come up with is not letting the Web Browser control open up a new window, but having the new URL launch in the control itself. Would that work for you?
Hmm... that might work... do you think it would work by launching it into my own Form with another browser instead?
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
-
Nov 8th, 2004, 11:01 AM
#4
Fanatic Member
Originally posted by Chris H
Hmm... that might work... do you think it would work by launching it into my own Form with another browser instead?
Hmm, I doubt it; though it could work. This code opens the url in an instance of frmBrowser. Try it out and let me know. 
VB Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim frm As frmBrowser
Set frm = New frmBrowser
Load frm
Set ppDisp = frm.WebBrowser1
frm.Show
Set frm = Nothing
End Sub
Author for Visual Basic Web Magazine
-
Nov 8th, 2004, 11:18 AM
#5
Thread Starter
Hyperactive Member
The new form and browser launch okay, but the browser doesn't seem to be navigating to the page specified by the link. I just get a blank browser window. Is there other code to make the new browser window go where it is supposed to?
EDIT: I must say though, that if I manually navigate the browser to the link by doing frm.WebBrowser1.Navigate "http://www.secure.com" that the "cookies" do appear to be travelling to the new browser window properly. If I could have it navigate there automatically that'd be great.
Last edited by Chris H; Nov 8th, 2004 at 11:24 AM.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
-
Nov 8th, 2004, 11:46 AM
#6
Thread Starter
Hyperactive Member
Okay I think I got it. I changed :
Set ppDisp = frm.WebBrowser1
to
Set ppDisp = frm.WebBrowser1.object
and that did the trick.
Thanks for your help. I should be able to work with this just fine.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|