WebBrowser.Source Property


Gets or sets the Uri of the current document hosted in the WebBrowser.

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

public Uri Source {

Property Value

Type: System.Uri

The Uri for the current HTML document.

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.

Setting the source property causes WebBrowser to navigate to the document specified by the Uri. If the Uri is null, a blank document is displayed ("about:blank").

The following example shows how to configure WebBrowser to navigate to an HTML document by using markup only.

<!-- Web Browser Control that hosts a web page. -->
<WebBrowser x:Name="webBrowser" Source="http://msdn.com" 
  Width="600" Height="600"  />

.NET Framework
Available since 3.0
Available since 4.0
Return to top