InsertDocumentFromURL Class Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

This class writes HTML from an external http source to the supplied stream or the default response stream. The InsertDocumentFromURL class acts as the underlying engine for the InsertDocumentFromURL AS component.
Inheritance Hierarchy

SystemObject
  ContentStudio.SiteCodeBase
    ContentStudio.Site.ActiveScriptingActiveScriptingBase
      ContentStudio.Site.ActiveScriptingDocumentBase
        ContentStudio.Site.ActiveScripting.DocumentInsertDocumentFromURL

Namespace: ContentStudio.Site.ActiveScripting.Document
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public sealed class InsertDocumentFromURL : DocumentBase

The InsertDocumentFromURL type exposes the following members.

Constructors

  NameDescription
Public methodInsertDocumentFromURL
Initializes a new instance of the InsertDocumentFromURL class.
Public methodInsertDocumentFromURL(Stream)
Initializes a new instance of the InsertDocumentFromURL class.
Top
Properties

  NameDescription
Public propertyBackwardsComponentCompatibilityMode
Sets or gets a value that indicates whether the code runs in backwards compatibility component mode. The default value is false.
(Inherited from ActiveScriptingBase.)
Public propertyComponentName
Gets the name of the component
(Overrides ActiveScriptingBaseComponentName.)
Public propertyConformance
Gets a value which specifies which type of code a component can generate.
(Overrides ActiveScriptingBaseConformance.)
Public propertyDomain
Gets or sets the domain.
Public propertyElementType
Gets a value which specifies the type of outer element the component generates.
(Overrides ActiveScriptingBaseElementType.)
Public propertyEncoding
Sets or gets the encoding the component uses. The default encoding is the UTF8 encoding without byte order mark.
(Inherited from ActiveScriptingBase.)
Public propertyFile
Gets or sets the file at the Domain from where the content should be retrieved.
Public propertyReplaceRelativeURL
Gets or sets a value indicating whether to replace absolute Url with relative url:s.
Public propertyStripBody
Gets or sets a value indicating whether to strip all html including and outside of the body element.
Public propertyUserName
Gets or sets the name of the user.
Top
Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodInvoke
This method invokes the component and writes its content into the specified stream
Public methodSetPassword
Sets the password.
Public methodToString (Inherited from Object.)
Top
Remarks

Create an instance of this object, set the properties that does not have their default values you expect and call the invoke method. This class can throw exceptions thus your code should be wrapped within try/catch statements in order to avoid the entire page to crash. The code generated is the content of the externa source and HTML/XHTML compatibility cannot be determined in advance.
Examples

The following code snippet shows how you can include a web page dynamically via its URL into an ordinary Content Studio document.
protected void Insert()
{
  ContentStudio.Site.ActiveScripting.Document.InsertDocumentFromURL idfu = 
     new ContentStudio.Site.ActiveScripting.Document.InsertDocumentFromURL();
  try
  {
     idfu.Domain = "http://contentstudio.se";
     idfu.File = "default.aspx";
     idfu.StripBody = true;
     idfu.ReplaceRelativeURL = true;
     idfu.Invoke();         
  }
  catch(Exception ex)
  {
     Response.Write(String.Format("InsertDocumentFromURL:{0}", ex.Message));
  }
}
To invoke the code add a new inline script block in the HTML-view within a block element:
Note Note
The server side call is written in C#, for VB.NET you must remove the trailing semi-colon (;)
<div>
  <% Insert();%>
</div>
See Also

Reference