当前位置: 首页>>代码示例>>C#>>正文


C# ContentAPI.GetDomainByContentId方法代码示例

本文整理汇总了C#中ContentAPI.GetDomainByContentId方法的典型用法代码示例。如果您正苦于以下问题:C# ContentAPI.GetDomainByContentId方法的具体用法?C# ContentAPI.GetDomainByContentId怎么用?C# ContentAPI.GetDomainByContentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentAPI的用法示例。


在下文中一共展示了ContentAPI.GetDomainByContentId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load


//.........这里部分代码省略.........
                    else if ((cQuickLink["LibraryFilename"].ToString().ToLower().IndexOf("downloadasset.aspx") >= 0) && (cQuickLink["ContentID"].ToString() != ""))
                    {
                        RedirectPath = m_refContentApi.AppPath + cQuickLink["LibraryFilename"].ToString();
                    }
                    else if (cQuickLink["LibraryFilename"].ToString().ToLower().IndexOf("linkit.aspx") < 0)
                    {
                        // make sure the quicklink doesn't link to this page or it'll be stuck in infinite loop
                        RedirectPath = m_refContentApi.SitePath + Server.HtmlDecode(Convert.ToString(cQuickLink["LibraryFilename"]));
                    }
                }
                else
                {
                    RedirectPath = (string) ((m_refContentApi.SitePath + aliasName).Replace("//", "/")); // If there is an alias it should show if they use linkit as Quicklink.
                }
            }
            if (((RedirectPath == "") && bUseQLink == true) || (bUseQLink == false))
            {
                // see if content has a multitemplate attached to it first
                templateData = m_refContentApi.GetMultiTemplateASPX(itemID);
                if (templateData == null)
                {
                    templateData = m_refContentApi.GetTemplatesByFolderId(m_refContentApi.GetJustFolderIdByContentId(itemID));
                }
                if (Convert.ToString(templateData.FileName).IndexOf("?") >= 0)
                {
                    RedirectPath = m_refContentApi.SitePath + templateData.FileName + "&" + strLinkIdentifier + "=" + itemID;
                }
                else
                {
                    RedirectPath = m_refContentApi.SitePath + templateData.FileName + "?" + strLinkIdentifier + "=" + itemID;
                }
            }
            if (string.IsNullOrEmpty(aliasName)) // Only if there is no alias append the following.
            {
                if (strNewQuery != "" && strNewQuery != "&")
                {
                    strNewQuery = strNewQuery.Trim("&".ToCharArray());
                    if (RedirectPath.IndexOf("?") >= 0)
                    {
                        RedirectPath = (string) (RedirectPath + "&" + strNewQuery);
                    }
                    else
                    {
                        RedirectPath = RedirectPath + "?" + strNewQuery;
                    }
                }
            }
            // domain folder redirect only if RedirectPath is not a full URL
            if (! RedirectPath.StartsWith("http"))
            {
                string domain = m_refContentApi.GetDomainByContentId(itemID);
                if (domain != null&& domain != "" && m_refContentApi.SitePath == "/")
                {
                    RedirectPath = (string) ("http://" + domain + "/" + RedirectPath.Substring(1));
                }
                else if (domain != null&& domain != "")
                {
                    RedirectPath = (string) ("http://" + domain + "/" + RedirectPath.Replace(m_refContentApi.SitePath, ""));
                }
            }
            if (Page.IsPostBack && (!(cQuickLink == null)) && cQuickLink.Count>0 && (Convert.ToInt32(cQuickLink["LibraryTypeID"]) == 5))
            {
                string strUrl = string.Empty;
                strUrl = m_refContentApi.QualifyUrlForServerTransfer(RedirectPath);
                if (strUrl.Length > 0)
                {
                    try
                    {
                        //#16799 - using the redirect to a page, the form data is not posting to specified template.
                        //Changed form response redirect to server.transfer to forward form values when possible.
                        //source:             CommonApi.vb(, ApplicationApi.vb, ServerControlLibrary / FormBlock / FormBlock.cs, workarea / linkit.aspx.vb)
                        //PRB: "View State Is Invalid" Error Message When You Use Server.Transfer
                        //http://support.microsoft.com/default.aspx?id=kb;en-us;Q316920
                        //Note: I have not seen the problem mentioned in the MS KB. -doug domeny 2005-11-22
                        Context.RewritePath(strUrl, false);
                        Server.Transfer(strUrl, true);
                        return;
                    }
                    catch (System.Threading.ThreadAbortException)
                    {
                       //When you do a Server.Transfer() or Response.Redirect(), if you have code after this statement, it sometimes throws an error.
                        return;
                    }
                    catch (Exception ex)
                    {
                        if (RedirectPath.IndexOf("?") >= 1)
                        {
                            RedirectPath += "&";
                        }
                        else
                        {
                            RedirectPath += "?";
                        }
                        RedirectPath += (string)("TransferError=" + EkFunctions.UrlEncode(ex.Message));
                    }
                }
            }

            Response.Redirect(RedirectPath);
    }
开发者ID:jaytem,项目名称:minGit,代码行数:101,代码来源:linkit.aspx.cs


注:本文中的ContentAPI.GetDomainByContentId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。