|
-
Mar 3rd, 2008, 06:16 PM
#1
Thread Starter
Junior Member
[2005] WebBrowser component trouble
Problem: When accessing a certain webpage through Firefox I can logout using this URL : http://www.lunarstorm.se/log/log_exit.aspx, but in Iexplore, it doesn't work, just get send to the mainpage, still being logged in, I need to find out why. I'm making a certain software that would force the logout, but it's using a VB .NET WebBrowser form (based on IE). Anyone know a solution to why the IE webbrowser form acts diffrent from Firefox in these type of cases?
Note: Doesn't work if I run IE directly either instead of using my software component.
-
Mar 3rd, 2008, 06:27 PM
#2
Re: [2005] WebBrowser component trouble
Could you show us your code? It doesnt sound like it should be doing that.
-
Mar 5th, 2008, 07:46 AM
#3
Thread Starter
Junior Member
Re: [2005] WebBrowser component trouble
I tried doing it through the Original IE and it seems like the site is blocking useing the URL directly more than once in a certain time. Though something in FF allows it. If the user is to click the logoff button on the site it works no matter how many times I log in / log off. So somethins is messed up.
Here's the code:
vb Code:
Public Class Form1 Dim userName As String Dim password As String Dim count As Double Dim counter As Double Dim x As Double Dim y As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click userName = TextBox1.Text password = TextBox2.Text count = TextBox3.Text counter = 0 ProgressBar1.Maximum = count countMonitor.Text = counter While counter < count WebBrowser1.Navigate("http://www.lunarstorm.se") Dim start As Integer start = My.Computer.Clock.TickCount() While My.Computer.Clock.TickCount() - start < 9000 Application.DoEvents() End While counter = counter + 1 countMonitor.Text = counter ProgressBar1.Value = counter WebBrowser1.Navigate("http://www.lunarstorm.se/log/log_exit.aspx") Dim start2 As Integer start2 = My.Computer.Clock.TickCount() While My.Computer.Clock.TickCount() - start2 < 7000 Application.DoEvents() End While End While End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted If WebBrowser1.Url.AbsoluteUri = "http://www.lunarstorm.se/" Then Try WebBrowser1.Document.GetElementsByTagName("input").Item(3).InnerText = TextBox1.Text WebBrowser1.Document.GetElementsByTagName("input").Item(4).InnerText = TextBox2.Text WebBrowser1.Navigate("javascript:__doPostBack('ctl07$ctl14$ebLogin$ebLogin_a','')") Catch ex As Exception End Try End If End Sub End class
-
Mar 5th, 2008, 08:06 AM
#4
Re: [2005] WebBrowser component trouble
Get rid of these:
vb Code:
While My.Computer.Clock.TickCount() - start < 9000
Application.DoEvents()
End While
You should take advantage of the DocumentCompleted event, navigate to the logout page from there.
Also, does this really work?
vb Code:
WebBrowser1.Navigate("javascript:__doPostBack('ctl07$ctl14$ebLogin$ebLogin_a','')")
-
Mar 5th, 2008, 08:50 AM
#5
Thread Starter
Junior Member
Re: [2005] WebBrowser component trouble
 Originally Posted by Atheist
Get rid of these:
vb Code:
While My.Computer.Clock.TickCount() - start < 9000
Application.DoEvents()
End While
You should take advantage of the DocumentCompleted event, navigate to the logout page from there.
Also, does this really work?
vb Code:
WebBrowser1.Navigate("javascript:__doPostBack('ctl07$ctl14$ebLogin$ebLogin_a','')")
Why should I get rid of them? I'm using the DocumentCompleted to make sure that the page is loaded before logging in, but how would I code so it waits for the page to load again before logging out?
The javascript navigating thing does work. It uses the javascript that is coded on the website for logging in. The application works all the way, logging in, but it doesn't log out, that's were the problem is.
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
|