Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebBrowser.Navigate Method (Uri)


Navigate asynchronously to the document at the specified Uri.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public void Navigate(
	Uri source


Type: System.Uri

The Uri to navigate to.

Exception Condition

The WebBrowser instance is no longer valid.


A reference to the underlying native WebBrowser could not be retrieved.


Navigation from an application that is running in partial trust to a Uri that is not located at the site of origin.

Calling Navigate(Uri) has the same effect as setting the Source property. Source is used from markup by developers who want to declaratively specify the initial document that WebBrowser navigates to when WebBrowser is initialized.

Use the Navigate(String) method to navigate to a URL that may include escape characters. Use the Navigate(Uri) method to navigate to a Uri that does not include escape characters.

The following example shows how to use WebBrowser to navigate to a document by using the Navigate(Uri) method.

    <StackPanel Orientation="Horizontal">
        <TextBox x:Name="addressTextBox" Width="200" />
        <Button Click="goNavigateButton_Click">Go</Button>
    <WebBrowser x:Name="myWebBrowser" />
private void goNavigateButton_Click(object sender, RoutedEventArgs e)
    // Get URI to navigate to
    Uri uri = new Uri(this.addressTextBox.Text, UriKind.RelativeOrAbsolute);

    // Only absolute URIs can be navigated to
    if (!uri.IsAbsoluteUri)
        MessageBox.Show("The Address URI must be absolute eg ''");

    // Navigate to the desired URL by calling the .Navigate method

.NET Framework
Available since 3.0
Available since 4.0
Return to top
© 2017 Microsoft