Stop Website Redirecting in VB 2005 Express  
Author Message
rohan_har





PostPosted: Visual Basic Express Edition, Stop Website Redirecting in VB 2005 Express Top

I am making a client for a game. When you attempt to go to a certain adress however, it will attempt to redirect you to their homepage.

The code to bypass this was posted on a website, however it is for VB 6. If anyone could help me convert this it would be very much appreciated.

VB6 Code:

"

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error Resume Next
If URL = " http://www.hide-link.com/ " Then Cancel = True
End Sub

"

The BeforeNavigate2 function does not exists in VB 2005, and the help files tell me it's been replaced by 'Navigating'.

Any help is appreciated.

Thanks,

rohan_har



Visual Studio Express Editions13  
 
 
nobugz





PostPosted: Visual Basic Express Edition, Stop Website Redirecting in VB 2005 Express Top

Try this:
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
If e.Url = New Uri("http://search.microsoft.com") Then e.Cancel = True
End Sub



 
 
rohan_har





PostPosted: Visual Basic Express Edition, Stop Website Redirecting in VB 2005 Express Top

Thank you so much, it worked :)