Content Studio Web Content Management System
SystemObject
ContentStudio.SiteCodeBase
ContentStudio.Site.ActiveScriptingActiveScriptingBase
ContentStudio.Site.ActiveScripting.MiscRedirectOnHost
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
Top
The RedirectOnHost class acts as the underlying engine for the Redirect on host Content Studio component.
Create an instance of this object, set the properties that does not have their default values you expect and call the invoke method.
The generates inline code thus you must wrap it into a block element in order for the resulting code to validate.
The code generated is fully HTML/XHTML strict compatible.
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 following code demonstrates how to use the RedirectOnHost class.
to redirect visitors to different parts of a web page based on the URL entered by the user. Typically you place this code on the top of a start page that acts as a switch between different parts of the website. Depending on the url the caller entered she will be redirected to different parts (ex. localized versions) of the web site. In this case the site has three domain pointing at the same site http://mycompany.se for international, http://mycompany.dk for Danish and http://mycompany.com for international vistors. In order to work this Content Studio site must be configured to use Multi homing both in Content Studio and in the web server.
[This is preliminary documentation and is subject to change.]
This class Redirects the user to a URL depending on hostname in request header.
Inheritance Hierarchy
ContentStudio.SiteCodeBase
ContentStudio.Site.ActiveScriptingActiveScriptingBase
ContentStudio.Site.ActiveScripting.MiscRedirectOnHost
Namespace: ContentStudio.Site.ActiveScripting.Misc
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
The RedirectOnHost type exposes the following members.
Constructors
Name | Description | |
---|---|---|
RedirectOnHost |
Constructs a new instance of the RedirectOnHost class.
|
Properties
Name | Description | |
---|---|---|
BackwardsComponentCompatibilityMode |
Sets or gets a value that indicates whether the code runs in backwards
compatibility component mode. The default value is false.
(Inherited from ActiveScriptingBase.) | |
ComponentName | Gets the name of the component (Overrides ActiveScriptingBaseComponentName.) | |
Conformance |
Gets a value which specifies which type of code a component can generate.
(Overrides ActiveScriptingBaseConformance.) | |
ElementType |
Gets a value which specifies the type of outer element the component generates.
(Overrides ActiveScriptingBaseElementType.) | |
Encoding |
Sets or gets the encoding the component uses. The default encoding is
the UTF8 encoding without byte order mark.
(Inherited from ActiveScriptingBase.) | |
EvaluationMethod |
Sets or gets a value that specifies how the host name in the request header should match the critera supplied in the Hostname property.
The default value is CriteriaEqual.
| |
Hostname |
Sets or gets a value that specifies the hostname to match on.
The default value is "www.".
| |
InverseCriteria |
Sets or gets a value that specifies whether to perform the redirect if criteria doesn't match or not.
The default value is false.
| |
RedirectURL |
Sets or gets a value that specifies an URL to redirect to if criteria is met, or if InverseCriteria is true no met.
The default value is "http://".
|
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
Invoke |
This method invokes the component.
| |
ToString | (Inherited from Object.) |
Remarks
Remarks
Examples
to redirect visitors to different parts of a web page based on the URL entered by the user. Typically you place this code on the top of a start page that acts as a switch between different parts of the website. Depending on the url the caller entered she will be redirected to different parts (ex. localized versions) of the web site. In this case the site has three domain pointing at the same site http://mycompany.se for international, http://mycompany.dk for Danish and http://mycompany.com for international vistors. In order to work this Content Studio site must be configured to use Multi homing both in Content Studio and in the web server.
C#
//Create the RedirectOnHost object and set the EvaluationMethod to CriteriaEqual RedirectOnHost bb = new RedirectOnHost(); bb.EvaluationMethod = ContentStudio.Site.ActiveScripting.Misc.RedirectOnHost.EvaluationMethods.CriteriaEqual; //Redirect Swedish customers to the Swedish start page bb.Hostname = "mycompany.se"; bb.RedirectURL = "http://mycompany.se/default.aspx?di=2348"; bb.Invoke(); //Redirect Danish customers to the Danish start page bb.Hostname = "mycompany.dk"; bb.RedirectURL = "http://mycompany.dk/default.aspx?di=3478"; bb.Invoke(); //The rest will be redirected to the International start page Response.Redirect("http://mycompany.com/default.aspx?di=8888");
Visual Basic
'Create the RedirectOnHost object and set the EvaluationMethod to CriteriaEqual Dim bb = New RedirectOnHost() bb.EvaluationMethod = ContentStudio.Site.ActiveScripting.Misc.RedirectOnHost.EvaluationMethods.CriteriaEqual 'Redirect Swedish customers to the Swedish start page bb.Hostname = "mycompany.se" bb.RedirectURL = "http://mycompany.se/default.aspx?di=2348" bb.Invoke(); 'Redirect Danish customers to the Danish start page bb.Hostname = "mycompany.dk" bb.RedirectURL = "http://mycompany.dk/default.aspx?di=3478" bb.Invoke() 'The rest will be redirected to the International start page Response.Redirect("http://mycompany.com/default.aspx?di=8888")
See Also