views:

51

answers:

2

Hi I like to create a simple web browser in VS.NET'08.I finished coding but while running it shows "Navigation to web page was canceled".Help me resolve this problem.Though i invoked the Navigate function inside the constructor,its not working.

public Form1()
    {
        InitializeComponent();
        webBrowser1.Navigate("http://google.com");
    }
+1  A: 

The webbrowser control needs a window handle to navigate to a string target. Try move the navigation code to a place after Form1.Show or Form1.ShowDialog, such as in Form1_Load. You can also call the Navigate(Uri url) overload, which just sets the Url property and a navigation would be called when the form is first shown or if the form is already displaying .

Sheng Jiang 蒋晟
+1 for navigating in the form's load event.
SnOrfus
A: 

Try Response.Redirect("http://www.microsoft.com")