CommonAliasManager
The CommonAliasManager class gets alias and target data that is common to any alias.
Namespace
Ektron.Cms.Framework.Settings.UrlAliasing.CommonAliasManager
Constructors
Constructors
CommonAliasManager()
CommonAliasManager(ApiAccessMode)
Properties
Properties
ApiMode
. Gets or sets the current API access mode. If set toAdmin
, the API runs with the permissions of an administrator.ApplicationPath
. Gets the application path to the Workarea.ContentLanguage
. Gets or sets the current content language.InPreviewMode
. Gets or sets the preview mode and returns true if the site is in preview mode.IsCommerceEnabled
. Checks for a commerce license.RequestInformation
. Gets information about the current request.SitePath
. Gets the site path.UserId
. Gets or sets the ID of the currently logged-in user.
Methods
Methods
GetContentAlias. Retrieves the alias of a content item.
GetContentAlias
GetContentAlias(System.Int64)
Retrieves the alias of a content item.
Authenticated users
- CMS Administrators
To create anonymous user access with this method, set the API access mode (ApiMode
) in the Manager class when instantiating the class.
Fields
*=Required
- * ID
Parameters
contentId
. ID of the content.
.aspx code snippet
<ol class="formFields"> <li class="clearfix"> <ektronUI:Label ID="uxContentIdLabel" AssociatedControlID="uxContentId" CssClass="span-3 last" runat="server" Text="* Id :" /> <ektronUI:TextField ID="uxContentId" CssClass="span-6" runat="server" ValidationGroup="RegisterValidationGroup" /> </li> <li class="clearfix"> <ektronUI:Button id="uxSubmit" runat="server" OnClick="uxSubmit_Click" Text="Get Content Alias"></ektronUI:Button> <ektronUI:Label ID="uxRequiredLabel" CssClass="span-3" runat="server" Text="* - Required" /> </li> </ol> <asp:Literal ID="uxMessage" runat="server"></asp:Literal>
.aspx.cs code-behind namespace
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Ektron.Cms.Framework.Settings.UrlAliasing;
.aspx.cs code-behind method
protected void uxSubmit_Click(object sender, EventArgs e) { try { CommonAliasManager commonAliasManager = new CommonAliasManager(); string contentAlias = commonAliasManager.GetContentAlias(long.Parse(uxContentId.Text)); MessageUtilities.UpdateMessage(uxMessage, "Content Alias : " + contentAlias, Message.DisplayModes.Success); uxPageMultiView.SetActiveView(uxViewMessage); } catch (Exception ex) { MessageUtilities.UpdateMessage(uxMessage, ex.Message, Message.DisplayModes.Error); uxPageMultiView.SetActiveView(uxViewMessage); } }
GetTarget. Retrieves the target of a uniform resource identifier (URI).
GetTarget
GetTarget(System.Uri)
Retrieves the target of a uniform resource identifier (URI).
Authenticated users
- CMS Administrators
To create anonymous user access with this method, set the API access mode (ApiMode
) in the Manager class when instantiating the class.
Fields
*=Required
- * URI
Parameters
uri
.aspx code snippet
<ol class="formFields"> <li class="clearfix"> <ektronUI:Label ID="uxUriLabel" AssociatedControlID="uxUri" CssClass="span-3 last" runat="server" Text="* Uri :" /> <ektronUI:TextField ID="uxUri" CssClass="span-6" runat="server" ValidationGroup="RegisterValidationGroup" Text="http://[HostName]/OnTrek_Releases_SelfServ_HelpDesk_Pro/" /> </li> <li class="clearfix"> <ektronUI:Button id="uxSubmit" runat="server" OnClick="uxSubmit_Click" Text="Get Target"></ektronUI:Button> <ektronUI:Label ID="uxRequiredLabel" CssClass="span-3" runat="server" Text="* - Required" /> </li> </ol> <asp:Literal ID="uxMessage" runat="server"></asp:Literal>
.aspx.cs code-behind namespace
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Ektron.Cms.Framework.Settings.UrlAliasing;
.aspx.cs code-behind method
protected void uxSubmit_Click(object sender, EventArgs e) { try { Uri uri = new Uri(uxUri.Text); CommonAliasManager commonAliasManager = new CommonAliasManager(); string contentAlias = commonAliasManager.GetTarget(uri); MessageUtilities.UpdateMessage(uxMessage, "Target : " + contentAlias, Message.DisplayModes.Success); uxPageMultiView.SetActiveView(uxViewMessage); } catch (Exception ex) { MessageUtilities.UpdateMessage(uxMessage, ex.Message, Message.DisplayModes.Error); uxPageMultiView.SetActiveView(uxViewMessage); } }