Is there alternative to AxWebBrowser?

  • Thread starter Thread starter MARTIN LANNY
  • Start date Start date
M

MARTIN LANNY

Is there alternative to AxWebBrowser?
I spent one whole week trying to make AxWebBrowser refresh php page.
It never works.
I tried over 10-15 suggestions from Microsoft itself.
Refresh just doesn't work.

I tried to create AxWebBrowser programatically, but it throws
exceptions when I want to dispose it and no one was able to help me or
tell me why.

When I ask AxWebBrowser.refresh, it should refresh. Instead and I spent
a week trying to get it to work...and I can't release my application
because of this crappy component.

I spent by now, at least 30 hours on this little stupid problem.

I need alternative to this component, something where refresh would
really work and reload the page from the scratch.

Thanks.

Martin
 
Martin,

An answer on your question, depends on what is your goal.

When you ask if there is an alternative for a car than that is difficult to
answer, however when you say that you have to go 100 meters than we can give
you a lot of answers.

When you will show pages on a screen, you can try to do it yourself, however
because of the composition from all elements it will be more than 30 hours
(more months probably).

When you want to get individual docs or whatever (what are not pages) you
can use the Httprequest

I hope this helps something?

Cor
 
Instead of 'Refresh' why don't u try navigate method. This will surely reload
ur page.
 
This problem was all because no one could get axwebbrowser to refresh
properly.
I found this function:

Public Function GetPageHTML(ByVal URL As String, Optional ByVal
TimeoutSeconds As Integer = 10) As String
' Retrieves the HTML from the specified URL,
' using a default timeout of 10 seconds
Dim objRequest As Net.WebRequest
Dim objResponse As Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objEncoding As System.Text.Encoding
Dim objStreamRead As System.IO.StreamReader

Try
' Setup our Web request
objRequest = Net.WebRequest.Create(URL)
objRequest.Timeout = TimeoutSeconds * 1000
' Retrieve data from request
objResponse = objRequest.GetResponse
objStreamReceive = objResponse.GetResponseStream
objEncoding = System.Text.Encoding.GetEncoding( _
"utf-8")
objStreamRead = New System.IO.StreamReader( _
objStreamReceive, objEncoding)
' Set function return value
GetPageHTML = objStreamRead.ReadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
objResponse.Close()
End If
Catch
' Error occured grabbing data, simply return nothing
Return ""
End Try
End Function

To grab html code from the page and it is always a new and refreshed
page.
So this solved my troubles and because I do not have to use
axwebbrowser anymore, my application went down in size by 7 mb.
Amazing ...
Anyway, thanks for trying to help me.

Martin
 
Martin,

When you had answered my question in this thread, than I had given you this
sample.

It is a little bit shorter.

\\\
Module main
Public Sub main()
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create("http://www.google.com"), _
Net.HttpWebRequest)
Dim myResp As Net.HttpWebResponse = _
DirectCast(myReg.GetResponse(), Net.HttpWebResponse)
Dim myStream As IO.Stream = myResp.GetResponseStream()
Dim myreader As New IO.StreamReader(myStream)
Dim mystring As String = myreader.ReadToEnd()
myResp.Close()
End Sub
End Module
///

However maybe you can still use it?

Cor
 
Above code I mentioned is better as it has a time out property, which
is good if you are going through intermediate login screen as I was.
Your code is good too, but it wouldn't work for my purposes.
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top