Edit

Share via


WebBrowser.Source Property

Definition

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

public:
 property Uri ^ Source { Uri ^ get(); void set(Uri ^ value); };
public Uri Source { [System.Security.SecurityCritical] get; set; }
public Uri Source { get; set; }
[<get: System.Security.SecurityCritical>]
member this.Source : Uri with get, set
member this.Source : Uri with get, set
Public Property Source As Uri

Property Value

Uri

The Uri for the current HTML document.

Attributes

Exceptions

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.

Examples

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"  />  

Remarks

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").

Applies to