• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Portals.PortalAliasInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalAliasInfo的典型用法代码示例。如果您正苦于以下问题:C# PortalAliasInfo类的具体用法?C# PortalAliasInfo怎么用?C# PortalAliasInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PortalAliasInfo类属于DotNetNuke.Entities.Portals命名空间,在下文中一共展示了PortalAliasInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DnnLink

        /// <summary>
        /// Generate WebAPI Links compatible with DNN Services Framework
        /// </summary>
        /// <param name="urlHelper">The UrlHelper</param>
        /// <param name="moduleFolderName">ModuleFolderName for the route</param>
        /// <param name="routeName">RouteName for the route</param>
        /// <param name="routeValues">Values to be passed to the route</param>
        /// <param name="portalAliasInfo">The PortalAlias to use in the Url </param>
        /// <returns>a url</returns>
        public static string DnnLink(this UrlHelper urlHelper, string moduleFolderName, string routeName, object routeValues, PortalAliasInfo portalAliasInfo)
        {
            var parm = new PortalAliasRouteManager();
            var fullName = parm.GetRouteName(moduleFolderName, routeName, PortalController.Instance.GetCurrentPortalSettings().PortalAlias);
            HttpRouteValueDictionary allRouteValues = parm.GetAllRouteValues(portalAliasInfo, routeValues);

            return urlHelper.Link(fullName, allRouteValues);
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:17,代码来源:UrlHelperExtensions.cs


示例2: PortalAliasInfo

 public PortalAliasInfo(PortalAliasInfo alias)
 {
     HTTPAlias = alias.HTTPAlias;
     PortalAliasID = alias.PortalAliasID;
     PortalID = alias.PortalID;
     IsPrimary = alias.IsPrimary;
     Redirect = alias.Redirect;
     BrowserType = alias.BrowserType;
     CultureCode = alias.CultureCode;
     Skin = alias.Skin;
 }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:11,代码来源:PortalAliasInfo.cs


示例3: AutoAddAlias

        protected static void AutoAddAlias(HttpContext context)
        {
            var portalId = Host.Host.HostPortalID;
            //the domain name was not found so try using the host portal's first alias
            if (portalId > Null.NullInteger)
            {
                var portalAliasInfo = new PortalAliasInfo { PortalID = portalId, HTTPAlias = Globals.GetDomainName(context.Request, true) };
                PortalAliasController.Instance.AddPortalAlias(portalAliasInfo);

                context.Response.Redirect(context.Request.Url.ToString(), true);
            }
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:12,代码来源:UrlRewriterBase.cs


示例4: GetAllRouteValues

        public HttpRouteValueDictionary GetAllRouteValues(PortalAliasInfo portalAliasInfo, object routeValues)
        {
            var allRouteValues = new HttpRouteValueDictionary(routeValues);

            var segments = portalAliasInfo.HTTPAlias.Split('/');
            
            if(segments.Length > 1)
            {
                  for(int i = 1; i < segments.Length; i++)
                  {
                      var key = "prefix" + (i - 1).ToString(CultureInfo.InvariantCulture);
                      var value = segments[i];
                      allRouteValues.Add(key, value);
                  }
            }

            return allRouteValues;
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:18,代码来源:PortalAliasRouteManager.cs


示例5: GetPortalAliasArrayByPortalID

 public ArrayList GetPortalAliasArrayByPortalID(int PortalID)
 {
     IDataReader dr = DotNetNuke.Data.DataProvider.Instance().GetPortalAliasByPortalID(PortalID);
     try
     {
         ArrayList arr = new ArrayList();
         while (dr.Read())
         {
             PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
             objPortalAliasInfo.PortalAliasID = Convert.ToInt32(dr["PortalAliasID"]);
             objPortalAliasInfo.PortalID = Convert.ToInt32(dr["PortalID"]);
             objPortalAliasInfo.HTTPAlias = Convert.ToString(dr["HTTPAlias"]).ToLower();
             arr.Add(objPortalAliasInfo);
         }
         return arr;
     }
     finally
     {
         if (dr != null)
         {
             dr.Close();
         }
     }
 }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:24,代码来源:PortalAliasController.cs


示例6: GetPortalAliasByPortalID

 public PortalAliasCollection GetPortalAliasByPortalID(int PortalID)
 {
     IDataReader dr = DotNetNuke.Data.DataProvider.Instance().GetPortalAliasByPortalID(PortalID);
     try
     {
         PortalAliasCollection objPortalAliasCollection = new PortalAliasCollection();
         while (dr.Read())
         {
             PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
             objPortalAliasInfo.PortalAliasID = Convert.ToInt32(dr["PortalAliasID"]);
             objPortalAliasInfo.PortalID = Convert.ToInt32(dr["PortalID"]);
             objPortalAliasInfo.HTTPAlias = Convert.ToString(dr["HTTPAlias"]);
             objPortalAliasCollection.Add(Convert.ToString(dr["HTTPAlias"]).ToLower(), objPortalAliasInfo);
         }
         return objPortalAliasCollection;
     }
     finally
     {
         if (dr != null)
         {
             dr.Close();
         }
     }
 }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:24,代码来源:PortalAliasController.cs


示例7: AdvancedUrlRewriter_PrimaryPortalAlias

        public void AdvancedUrlRewriter_PrimaryPortalAlias(Dictionary<string, string> testFields)
        {
            string defaultAlias = testFields["DefaultAlias"];

            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            string language = testFields["Language"].Trim();
            string skin = testFields["Skin"].Trim();
            if (!String.IsNullOrEmpty(language))
            {
                _customLocale = new Locale { Code = language, Fallback = "en-US" };
                _customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName;
                Localization.SaveLanguage(_customLocale);
                Localization.AddLanguageToPortals(_customLocale.LanguageId);

            }

            if (testFields.ContainsKey("Final Url"))
            {
                testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias);
            }

            if (!(String.IsNullOrEmpty(language) && String.IsNullOrEmpty(skin)))
            {
                //add new primary alias
                _primaryAlias = new PortalAliasInfo
                                    {
                                        PortalID = PortalId,
                                        HTTPAlias = defaultAlias,
                                        CultureCode = language,
                                        Skin = skin,
                                        IsPrimary = true
                                    };
                _primaryAlias.PortalAliasID = TestablePortalAliasController.Instance.AddPortalAlias(_primaryAlias);
                ExecuteTest(settings, testFields, true);
            }
            else
            {
                SetDefaultAlias(defaultAlias);
                ExecuteTest(settings, testFields, false);
            }

        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:45,代码来源:UrlRewriteTests.cs


示例8: GetPortalAliasProperties

 protected abstract void GetPortalAliasProperties(int index, PortalAliasInfo portalAlias);
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:1,代码来源:PortAliasesModuleBase.cs


示例9: AddLanguageHttpAlias

        private static void AddLanguageHttpAlias(int portalId, Locale locale)
        {
            if (Config.GetFriendlyUrlProvider() == "advanced")
            {
                // create new HTTPAlias for language
                var portalInfo = PortalController.Instance.GetPortal(portalId);
                PortalAliasInfo currentAlias = null;
                string httpAlias = null;

                var portalAliasses = PortalAliasController.Instance.GetPortalAliasesByPortalId(portalId);
                var portalAliasInfos = portalAliasses as IList<PortalAliasInfo> ?? portalAliasses.ToList();
                if (portalAliasses != null && portalAliasInfos.Any())
                {
                    currentAlias = portalAliasInfos.First();
                    httpAlias = currentAlias.HTTPAlias;
                }

                if (currentAlias != null && !string.IsNullOrEmpty(httpAlias) && portalInfo != null)
                {

                    if (!string.IsNullOrEmpty(currentAlias.CultureCode))
                    {
                        // the portal alias is culture specific
                        if (currentAlias.CultureCode == portalInfo.CultureCode)
                        {
                            // remove the culture from the alias
                            httpAlias = httpAlias.Substring(0, httpAlias.LastIndexOf("/", StringComparison.Ordinal));
                        }
                    }

                    var alias = GetValidLanguageURL(portalId, httpAlias, locale.Code.ToLowerInvariant());
                    if (!String.IsNullOrEmpty(alias))
                    {
                        var newAlias = new PortalAliasInfo(currentAlias)
                            {
                                IsPrimary = true,
                                CultureCode = locale.Code,
                                HTTPAlias = GetValidLanguageURL(portalId, httpAlias, locale.Code.ToLowerInvariant())
                            };

                        PortalAliasController.Instance.AddPortalAlias(newAlias);
                    }
                }
            }
        }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:45,代码来源:Localization.cs


示例10: AddPortalAlias

 protected string AddPortalAlias(string portalAlias, int portalID)
 {
     if (!String.IsNullOrEmpty(portalAlias))
     {
         if (portalAlias.IndexOf("://", StringComparison.Ordinal) != -1)
         {
             portalAlias = portalAlias.Remove(0, portalAlias.IndexOf("://", StringComparison.Ordinal) + 3);
         }
         var alias = PortalAliasController.Instance.GetPortalAlias(portalAlias, portalID);
         if (alias == null)
         {
             alias = new PortalAliasInfo { PortalID = portalID, HTTPAlias = portalAlias };
             PortalAliasController.Instance.AddPortalAlias(alias);
         }
     }
     return portalAlias;
 }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:17,代码来源:SiteSettings.ascx.cs


示例11: AddAlias

        protected void AddAlias(object sender, EventArgs e)
        {
            //Add a new empty rule and set the editrow to the new row
            var portalAlias = new PortalAliasInfo { PortalID = CurrentPortalId };
            Aliases.Add(portalAlias);
            Grid.EditItemIndex = Aliases.Count - 1;

            //Set the AddMode to true
            AddMode = true;

            //Rebind the collection
            BindAliases();
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:13,代码来源:PortAliasesModuleBase.cs


示例12: MakeUrlWithAlias

 private static string MakeUrlWithAlias(Uri requestUri, PortalAliasInfo alias)
 {
     return MakeUrlWithAlias(requestUri, alias.HTTPAlias);
 }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:4,代码来源:AdvancedUrlRewriter.cs


示例13: AdvancedUrlProvider_PrimaryPortalAlias

        public void AdvancedUrlProvider_PrimaryPortalAlias(Dictionary<string, string> testFields)
        {
            string defaultAlias = testFields["DefaultAlias"];
            string redirectMode = testFields["RedirectMode"];

            var settings = UrlTestFactoryClass.GetSettings("FriendlyUrl", "PrimaryPortalAlias");

            string language = testFields["Language"].Trim();
            if (!String.IsNullOrEmpty(language))
            {
                _customLocale = new Locale { Code = language, Fallback = "en-US" };
                _customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName;
                Localization.SaveLanguage(_customLocale);
                Localization.AddLanguageToPortals(_customLocale.LanguageId);

                //add new primary alias
                _primaryAlias = new PortalAliasInfo
                {
                    PortalID = PortalId,
                    HTTPAlias = defaultAlias,
                    CultureCode = language,
                    IsPrimary = true
                };
                _primaryAlias.PortalAliasID = PortalAliasController.Instance.AddPortalAlias(_primaryAlias);
            }
            else
            {
                SetDefaultAlias(defaultAlias);
            }

            PortalController.UpdatePortalSetting(PortalId, "PortalAliasMapping", redirectMode);

            ExecuteTest("Improved", settings, testFields);
        }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:34,代码来源:FriendlyUrlTests.cs


示例14: GetHostPortalSettings

 /// <summary>
 /// Gets the host portal settings.
 /// </summary>
 /// <returns>Host portal settings</returns>
 public static PortalSettings GetHostPortalSettings()
 {
     int TabId = -1;
     int PortalId = -1;
     PortalAliasInfo objPortalAliasInfo = null;
     //if the portal alias exists
     if (Host.HostPortalID > Null.NullInteger)
     {
         PortalId = Host.HostPortalID;
         // use the host portal
         objPortalAliasInfo = new PortalAliasInfo();
         objPortalAliasInfo.PortalID = PortalId;
     }
     // load the PortalSettings into current context
     return new PortalSettings(TabId, objPortalAliasInfo);
 }
开发者ID:vsnobbert,项目名称:Dnn.Platform,代码行数:20,代码来源:Globals.cs


示例15: AddPortalAlias

 protected string AddPortalAlias(string portalAlias, int portalID)
 {
     if (!String.IsNullOrEmpty(portalAlias))
     {
         if (portalAlias.IndexOf("://") != -1)
         {
             portalAlias = portalAlias.Remove(0, portalAlias.IndexOf("://") + 3);
         }
         var objPortalAliasController = new PortalAliasController();
         var objPortalAlias = objPortalAliasController.GetPortalAlias(portalAlias, portalID);
         if (objPortalAlias == null)
         {
             objPortalAlias = new PortalAliasInfo { PortalID = portalID, HTTPAlias = portalAlias };
             objPortalAliasController.AddPortalAlias(objPortalAlias);
         }
     }
     return portalAlias;
 }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:18,代码来源:SiteSettings.ascx.cs


示例16: TransformFriendlyUrlToQueryString

 public override string TransformFriendlyUrlToQueryString(string[] urlParms, int tabId, int portalId, FriendlyUrlOptions options, string cultureCode, PortalAliasInfo portalAlias, ref List<string> messages, out int status, out string location)
 {
     throw new NotImplementedException();
 }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:4,代码来源:ExtensionUrlProviderControllerTests.cs


示例17: AdvancedUrlRewriter_PrimaryPortalAlias

        public void AdvancedUrlRewriter_PrimaryPortalAlias(Dictionary<string, string> testFields)
        {
            string defaultAlias = testFields["DefaultAlias"];

            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            string language = testFields["Language"].Trim();
            string skin = testFields["Skin"].Trim();
            if (!String.IsNullOrEmpty(language))
            {
                _customLocale = new Locale { Code = language, Fallback = "en-US" };
                _customLocale.Text = CultureInfo.GetCultureInfo(_customLocale.Code).NativeName;
                Localization.SaveLanguage(_customLocale);
                Localization.AddLanguageToPortals(_customLocale.LanguageId);

            }

            if (testFields.ContainsKey("Final Url"))
            {
                testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias);
            }

            PortalController.UpdatePortalSetting(PortalId, "PortalAliasMapping", "REDIRECT", "en-us");
            var alias = PortalAliasController.Instance.GetPortalAlias(defaultAlias, PortalId);
            if (alias == null)
            {
                alias = new PortalAliasInfo
                {
                    HTTPAlias = defaultAlias,
                    PortalID = PortalId,
                    IsPrimary = true
                };
                if (!(String.IsNullOrEmpty(language) && String.IsNullOrEmpty(skin)))
                {
                    alias.CultureCode = language;
                    alias.Skin = skin;
                }
               PortalAliasController.Instance.AddPortalAlias(alias);
            }
            SetDefaultAlias(defaultAlias);
            ExecuteTest(settings, testFields, false);


            alias = PortalAliasController.Instance.GetPortalAlias(defaultAlias, PortalId);
            if (alias != null)
            {
                PortalAliasController.Instance.DeletePortalAlias(alias);
            }
        }
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:51,代码来源:UrlRewriteTests.cs


示例18: AddPortalAlias

        /// <summary>
        /// Creates a new portal alias
        /// </summary>
        /// <param name="PortalId">Id of the portal</param>
        /// <param name="PortalAlias">Portal Alias to be created</param>
        /// <history>
        ///     [cnurse]    01/11/2005  created
        /// </history>
        public void AddPortalAlias( int PortalId, string PortalAlias )
        {
            PortalAliasController objPortalAliasController = new PortalAliasController();

            //Check if the Alias exists
            PortalAliasInfo objPortalAliasInfo = objPortalAliasController.GetPortalAlias( PortalAlias, PortalId );

            //If alias does not exist add new
            if( objPortalAliasInfo == null )
            {
                objPortalAliasInfo = new PortalAliasInfo();
                objPortalAliasInfo.PortalID = PortalId;
                objPortalAliasInfo.HTTPAlias = PortalAlias;
                objPortalAliasController.AddPortalAlias( objPortalAliasInfo );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:24,代码来源:PortalController.cs


示例19: BuildPortalAliasesRegexDictionary

        private static OrderedDictionary BuildPortalAliasesRegexDictionary()
        {
            IDictionary<string, PortalAliasInfo> aliases = TestablePortalAliasController.Instance.GetPortalAliases();
            //create a new OrderedDictionary.  We use this because we
            //want to key by the correct regex pattern and return the
            //portalAlias that matches, and we want to preserve the
            //order of the items, such that the item with the most path separators (/)
            //is at the front of the list.  
            var regexList = new OrderedDictionary(aliases.Count);
            //this regex pattern, when formatted with the httpAlias, will match a request 
            //for this portalAlias
            const string aliasRegexPattern = @"(?:^(?<http>http[s]{0,1}://){0,1})(?:(?<alias>_ALIAS_)(?<path>$|\?[\w]*|/[\w]*))";
            var pathLengths = new List<int>();
            foreach (string aliasKey in aliases.Keys)
            {
                PortalAliasInfo alias = aliases[aliasKey];
                //regex escape the portal alias for inclusion into a regex pattern
                string plainAlias = alias.HTTPAlias;
                string escapedAlias = Regex.Escape(plainAlias);
                var aliasesToAdd = new List<string> { escapedAlias };
                //check for existence of www. version of domain, if it doesn't have a www.
                if (plainAlias.ToLower().StartsWith("www."))
                {
                    if (plainAlias.Length > 4)
                    {
                        string noWWWVersion = plainAlias.Substring(4);
                        if (!aliases.ContainsKey(noWWWVersion))
                        {
                            //there is no no-www version of the alias
                            aliasesToAdd.Add(Regex.Escape(noWWWVersion));
                        }
                    }
                }
                else
                {
                    string wwwVersion = "www." + plainAlias;
                    if (!aliases.ContainsKey(wwwVersion))
                    {
                        aliasesToAdd.Add(Regex.Escape(wwwVersion));
                    }
                }
                int count = 0;
                foreach (string aliasToAdd in aliasesToAdd)
                {
                    //set flag on object to know whether to redirect or not
                    count++;
                    var aliasObject = new PortalAliasInfo(alias) { Redirect = count != 1 };

                    //format up the regex pattern by replacing the alias portion with the portal alias name
                    string regexPattern = aliasRegexPattern.Replace("_ALIAS_", aliasToAdd);
                    //work out how many path separators there are in the portalAlias (ie myalias/mychild = 1 path)
                    int pathLength = plainAlias.Split('/').GetUpperBound(0);
                    //now work out where in the list we should put this portalAlias regex pattern
                    //the list is to be sorted so that those aliases with the most paths 
                    //are at the front of the list : ie, they are tested first
                    int insertPoint = pathLengths.Count - 1;
                    //walk through the existing list of path lengths,
                    //and ascertain where in the list this one falls
                    //if they are all the same path length, then place them in portal alias order
                    for (int i = 0; i < pathLengths.Count; i++)
                    {
                        insertPoint = i;
                        if (pathLength > pathLengths[i])
                        {
                            //larger than this position, insert at this value
                            break;
                        }
                        insertPoint++; //next one along (if at end, means add)
                    }
                    if (pathLengths.Count > 0 && insertPoint <= pathLengths.Count - 1)
                    {
                        //put the new regex pattern into the correct position
                        regexList.Insert(insertPoint, regexPattern, aliasObject);
                        pathLengths.Insert(insertPoint, pathLength);
                    }
                    else
                    {
                        //put the new regex pattern on the end of the list
                        regexList.Add(regexPattern, aliasObject);
                        pathLengths.Add(pathLength);
                    }
                }
            }
            return regexList;
        }
开发者ID:vsnobbert,项目名称:Dnn.Platform,代码行数:85,代码来源:TabIndexController.cs


示例20: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var tab = TabController.Instance.GetTabByName(_aboutUsPageName, PortalId);
            if (tab == null)
            {
                CreateTab(_aboutUsPageName);
                tab = TabController.Instance.GetTabByName(_aboutUsPageName, PortalId);
            }
            _tabId = tab.TabID;

            //Add Portal Aliases
            var aliasController = PortalAliasController.Instance;
            TestUtil.ReadStream(String.Format("{0}", "Aliases"), (line, header) =>
                        {
                            string[] fields = line.Split(',');
                            var alias = aliasController.GetPortalAlias(fields[0], PortalId);
                            if (alias == null)
                            {
                                alias = new PortalAliasInfo
                                                {
                                                    HTTPAlias = fields[0],
                                                    PortalID = PortalId
                                                };
                                PortalAliasController.Instance.AddPortalAlias(alias);
                            }
                        });
            TestUtil.ReadStream(String.Format("{0}", "Users"), (line, header) =>
                        {
                            string[] fields = line.Split(',');

                            TestUtil.AddUser(PortalId, fields[0].Trim(), fields[1].Trim(), fields[2].Trim());
                        });
        }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:35,代码来源:FriendlyUrlTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Portals.PortalController类代码示例发布时间:2022-05-24
下一篇:
C# Portals.PortalAliasController类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap