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


C# PortalAliasController.AddPortalAlias方法代码示例

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


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

示例1: SaveAlias

        protected void SaveAlias(object source, CommandEventArgs e)
        {
            var controller = new PortalAliasController();
            bool isChild = false;
            string childPath = string.Empty;
            string message = string.Empty;

            //Get the index of the row to save
            int index = dgPortalAlias.EditItemIndex;

            var portalAlias = (PortalAliasInfo) Aliases[index];
            var ctlAlias = (TextBox) dgPortalAlias.Items[index].Cells[1].FindControl("txtHTTPAlias");
            var chkChild = (CheckBox) dgPortalAlias.Items[index].Cells[2].FindControl("chkChild");

            string strAlias = ctlAlias.Text.Trim();
            if (string.IsNullOrEmpty(strAlias))
            {
                message = Localization.GetString("InvalidAlias", LocalResourceFile);
            }
            else
            {
                if (strAlias.IndexOf("://") != -1)
                {
                    strAlias = strAlias.Remove(0, strAlias.IndexOf("://") + 3);
                }
                if (strAlias.IndexOf("\\\\") != -1)
                {
                    strAlias = strAlias.Remove(0, strAlias.IndexOf("\\\\") + 2);
                }

                isChild = (chkChild != null && chkChild.Checked);

                //Validate Alias
                if (!PortalAliasController.ValidateAlias(strAlias, false))
                {
                    message = Localization.GetString("InvalidAlias", LocalResourceFile);
                }

                //Validate Child Folder Name
                if (isChild)
                {
                    childPath = strAlias.Substring(strAlias.LastIndexOf("/") + 1);
                    if (!PortalAliasController.ValidateAlias(childPath, true))
                    {
                        message = Localization.GetString("InvalidAlias", LocalResourceFile);
                    }
                }
            }

            if (string.IsNullOrEmpty(message) && isChild)
            {
                //Attempt to create child folder
                string childPhysicalPath = Server.MapPath(childPath);

                if (Directory.Exists(childPhysicalPath))
                {
                    message = Localization.GetString("ChildExists", LocalResourceFile);
                }
                else
                {
                    message = PortalController.CreateChildPortalFolder(childPhysicalPath);
                }
            }

            if (string.IsNullOrEmpty(message))
            {
                portalAlias.HTTPAlias = strAlias;
                if (AddMode)
                {
                    controller.AddPortalAlias(portalAlias);
                }
                else
                {
                    controller.UpdatePortalAliasInfo(portalAlias);
                }

                //Reset Edit Index
                lblError.Visible = false;
                dgPortalAlias.EditItemIndex = -1;
                _Aliases = null;
            }
            else
            {
                lblError.Text = message;
                lblError.Visible = true;
            }

            BindAliases();
        }
开发者ID:rickfox,项目名称:Steves,代码行数:89,代码来源:PortalAliases.ascx.cs

示例2: 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

示例3: 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

示例4: cmdUpdate_Click

        /// <summary>
        /// cmdUpdate_Click runs when the Update button is clicked
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/17/2005	documented
        /// </history>
        protected void cmdUpdate_Click( Object sender, EventArgs e )
        {
            try
            {
                string strAlias = txtAlias.Text;
                if( !String.IsNullOrEmpty(strAlias) )
                {
                    if( strAlias.IndexOf( "://" ) != - 1 )
                    {
                        strAlias = strAlias.Remove( 0, strAlias.IndexOf( "://" ) + 3 );
                    }
                    if( strAlias.IndexOf( "\\\\" ) != - 1 )
                    {
                        strAlias = strAlias.Remove( 0, strAlias.IndexOf( "\\\\" ) + 2 );
                    }

                    PortalAliasController p = new PortalAliasController();
                    if( ViewState["PortalAliasID"] != null )
                    {
                        PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
                        objPortalAliasInfo.PortalAliasID = Convert.ToInt32( ViewState["PortalAliasID"] );
                        objPortalAliasInfo.PortalID = Convert.ToInt32( ViewState["PortalID"] );
                        objPortalAliasInfo.HTTPAlias = strAlias;
                        try
                        {
                            p.UpdatePortalAliasInfo(objPortalAliasInfo);
                        }
                        catch
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateAlias", this.LocalResourceFile), ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        PortalAliasInfo objPortalAliasInfo;
                        objPortalAliasInfo = p.GetPortalAlias( strAlias, Convert.ToInt32( ViewState["PortalAliasID"] ) );
                        if( objPortalAliasInfo == null )
                        {
                            objPortalAliasInfo = new PortalAliasInfo();
                            objPortalAliasInfo.PortalID = Convert.ToInt32( ViewState["PortalID"] );
                            objPortalAliasInfo.HTTPAlias = strAlias;
                            p.AddPortalAlias( objPortalAliasInfo );
                        }
                        else
                        {
                            UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "DuplicateAlias", this.LocalResourceFile ), ModuleMessageType.RedError );
                            return;
                        }
                    }
                    UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "Success", this.LocalResourceFile ), ModuleMessageType.GreenSuccess );
                    Response.Redirect( Convert.ToString( ViewState["UrlReferrer"] ), true );
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:65,代码来源:EditPortalAlias.ascx.cs

示例5: OnBeginRequest

        public void OnBeginRequest(object s, EventArgs e)
        {
            var app = (HttpApplication) s;
            var server = app.Server;
            var request = app.Request;
            var response = app.Response;
            var requestedPath = app.Request.Url.AbsoluteUri;

            if (RewriterUtils.OmitFromRewriteProcessing(request.Url.LocalPath))
            {
                return;
            }

            //'Carry out first time initialization tasks
            Initialize.Init(app);
            if (request.Url.LocalPath.ToLower().Contains("/install/install.aspx")
                || request.Url.LocalPath.ToLower().Contains("/install/upgradewizard.aspx")
                || request.Url.LocalPath.ToLower().Contains("/install/installwizard.aspx")
                || request.Url.LocalPath.ToLower().Contains("captcha.aspx")
                || request.Url.LocalPath.ToLower().Contains("scriptresource.axd")
                || request.Url.LocalPath.ToLower().Contains("webresource.axd")
                || request.Url.LocalPath.ToLower().Contains("dmxdav.axd")
                )
            {
                return;
            }

            //URL validation
            //check for ".." escape characters commonly used by hackers to traverse the folder tree on the server
            //the application should always use the exact relative location of the resource it is requesting
            var strURL = request.Url.AbsolutePath;
            var strDoubleDecodeURL = server.UrlDecode(server.UrlDecode(request.RawUrl));
            if (Regex.Match(strURL, "[\\\\/]\\.\\.[\\\\/]").Success || Regex.Match(strDoubleDecodeURL, "[\\\\/]\\.\\.[\\\\/]").Success)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request);
            }
            try
            {
                //fix for ASP.NET canonicalization issues http://support.microsoft.com/?kbid=887459
                if ((request.Path.IndexOf("\\") >= 0 || Path.GetFullPath(request.PhysicalPath) != request.PhysicalPath))
                {
                    DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request);
                }
            }
            catch (Exception exc)
            {
                //DNN 5479
                //request.physicalPath throws an exception when the path of the request exceeds 248 chars.
                //example to test: http://localhost/dotnetnuke_2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/default.aspx
                DnnLog.Error("RawUrl:"+request.RawUrl + " / Referrer:" + request.UrlReferrer.AbsoluteUri, exc);

            }
            #if DEBUG
            var timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            app.Context.Items.Add("UrlRewrite:Timer", timer);
            #endif

            String domainName;
            RewriteUrl(app, out domainName);

            //blank DomainName indicates RewriteUrl couldn't locate a current portal
            //reprocess url for portal alias if auto add is an option
            if(domainName == "" && CanAutoAddPortalAlias())
            {
                domainName = Globals.GetDomainName(app.Request, true);
            }

            //from this point on we are dealing with a "standard" querystring ( ie. http://www.domain.com/default.aspx?tabid=## )
            //if the portal/url was succesfully identified

            var tabId = Null.NullInteger;
            var portalId = Null.NullInteger;
            string portalAlias = null;
            PortalAliasInfo portalAliasInfo = null;
            var parsingError = false;

            // get TabId from querystring ( this is mandatory for maintaining portal context for child portals )
            if (!string.IsNullOrEmpty(request.QueryString["tabid"]))
            {
                if (!Int32.TryParse(request.QueryString["tabid"], out tabId))
                {
                    tabId = Null.NullInteger;
                    parsingError = true;
                }
            }

            // get PortalId from querystring ( this is used for host menu options as well as child portal navigation )
            if (!string.IsNullOrEmpty(request.QueryString["portalid"]))
            {
                if (!Int32.TryParse(request.QueryString["portalid"], out portalId))
                {
                    portalId = Null.NullInteger;
                    parsingError = true;
                }
            }

            if (parsingError)
            {
//.........这里部分代码省略.........
开发者ID:robsiera,项目名称:OpenUrlRewriter,代码行数:101,代码来源:UrlRewriteModule.cs

示例6: 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>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    01/11/2005  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void AddPortalAlias(int portalId, string portalAlias)
        {
            PortalAliasController portalAliasController = new PortalAliasController();

            //Check if the Alias exists
            PortalAliasInfo portalAliasInfo = portalAliasController.GetPortalAlias(portalAlias, portalId);

            //If alias does not exist add new
            if (portalAliasInfo == null)
            {
                portalAliasInfo = new PortalAliasInfo();
                portalAliasInfo.PortalID = portalId;
                portalAliasInfo.HTTPAlias = portalAlias;
                portalAliasController.AddPortalAlias(portalAliasInfo);
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:28,代码来源:PortalController.cs


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