WebBrowser.DocumentStream Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a stream containing the contents of the Web page displayed in the WebBrowser control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public Stream DocumentStream { get; set; }
/** @property */
public Stream get_DocumentStream ()

/** @property */
public void set_DocumentStream (Stream value)

public function get DocumentStream () : Stream

public function set DocumentStream (value : Stream)

Property Value

A Stream containing the contents of the current Web page, or a null reference (Nothing in Visual Basic) if no page is loaded. The default is a null reference (Nothing in Visual Basic).

Exception typeCondition


This WebBrowser instance is no longer valid.


A reference to an implementation of the IWebBrowser2 could not be retrieved from the underlying ActiveX WebBrowser.

Use this property to load a Web page into the WebBrowser control from a Stream object. You can use this property, for example, to load Web pages from a database or resource file. When you set this property, the WebBrowser control automatically navigates to the about:blank URL before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events occur when you set this property, and the value of the Url property is no longer meaningful.

To access the contents of a Web page as a string, use the DocumentText property. You can also access the page contents using the HTML document object model (DOM) through the Document property.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions