Example #1
0
        public bool IsInIgnoreList(string uriPrm)
        {
            //Ignore all
            if (IgnoredUriParameters.Trim() == "*")
            {
                return(true);
            }

            if (IgnoredUriParameters.Trim() == "")
            {
                return(false);
            }

            uriPrm = uriPrm.ToLower();
            string[] prms = IgnoredUriParameters.ToLower().Split('|');
            foreach (string prm in prms)
            {
                if (prm == uriPrm)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        string GetUriParameters(string sourceUrl)
        {
            StringBuilder sb  = new StringBuilder();
            string        src = sourceUrl.ToLower();

            if (IgnoredUriParameters.Trim() != "*" &&
                HttpContext.Current.Request.Url.Query != null &&
                HttpContext.Current.Request.Url.Query.Length > 0)
            {
                string[] prms = HttpContext.Current.Request.Url.Query.Replace("?", "").Split('&');

                //if paremeter isn't already added to the returning string
                foreach (string prm in prms)
                {
                    if (prm.Trim().Length == 0)
                    {
                        continue;
                    }

                    string prmName = (prm.Split('='))[0].ToLower();

                    //if parameter hasn't been added
                    if (src.IndexOf("&" + prmName + "=") < 0)
                    {
                        //if the parementer is not in the ignore list
                        if (!IsInIgnoreList(prmName))
                        {
                            if (sb.ToString().ToLower().IndexOf(prmName) < 0)
                            {
                                sb.Append("&" + prm);
                            }
                        }
                    }
                }
            }

            return(sb.ToString());
        }
Example #3
0
        //public string GetFilePath(string path, bool addParams)
        //{
        //    string strRtn = path;

        //    if (path.IndexOf("http:") < 0)
        //    {
        //        string root = "http://" +
        //                    HttpContext.Current.Request.Url.Host +
        //                    ":" + HttpContext.Current.Request.Url.Port;

        //        strRtn = path.Replace("~", "");
        //        if (!strRtn.StartsWith("/"))
        //            strRtn += "/";

        //        strRtn = root + strRtn;
        //    }

        //    if (addParams)
        //        strRtn += GetParamsForServiceCall();

        //    return strRtn;
        //}


        string GetParamsForServiceCall()
        {
            ContestId      = GetPropertyValue("ContestId", ContestId, 0);
            ContestGroupId = GetPropertyValue("ContestGroupId", ContestGroupId, 0);
            UserId         = GetPropertyValue("UserId", UserId, 0);

            PageSize  = GetPropertyValue("pagesize", PageSize, 0);
            PageIndex = GetPropertyValue("pageindex", PageIndex, 0);

            StringBuilder sb = new StringBuilder("");

            sb.Append("?method=" + MethodName);
            sb.Append("&siteid=" + SiteId);
            sb.Append("&type=" + XMLType.ToString());

            if (ContestId > 0)
            {
                sb.Append("&contestid=" + ContestId);
            }
            if (ContestGroupId > 0)
            {
                sb.Append("&groupid=" + ContestGroupId);
            }
            if (UserId > 0)
            {
                sb.Append("&userid=" + UserId);
            }

            if (PageSize > 0)
            {
                sb.Append("&pagesize=" + PageSize);
            }
            if (PageIndex > 0)
            {
                sb.Append("&pageindex=" + PageIndex);
            }
            if (ContestEntryDate.Trim().Length > 0)
            {
                sb.Append("&date=" + ContestEntryDate);
            }
            if (Parameters.Trim().Length > 0)
            {
                sb.Append("&prms=" + Parameters);
            }

            if (IgnoredUriParameters.Trim() != "*" &&
                HttpContext.Current.Request.Url.Query != null &&
                HttpContext.Current.Request.Url.Query.Length > 0)
            {
                string[] prms = HttpContext.Current.Request.Url.Query.Replace("?", "").Split('&');

                //if paremeter isn't already added to the returning string
                foreach (string prm in prms)
                {
                    if (prm.Trim().Length == 0)
                    {
                        continue;
                    }

                    string prmName = (prm.Split('='))[0];

                    if (!IsInIgnoreList(prmName))
                    {
                        if (sb.ToString().ToLower().IndexOf(prmName.ToLower()) < 0)
                        {
                            sb.Append("&" + prm);
                        }
                    }
                }
            }

            return(sb.ToString());
        }
Example #4
0
        string GetParamsForServiceCall()
        {
            PollId    = GetPropertyValue("PollId", PollId, 0);
            PageSize  = GetPropertyValue("pagesize", PageSize, 0);
            PageIndex = GetPropertyValue("pageindex", PageIndex, 0);

            StringBuilder sb = new StringBuilder("");

            sb.Append("?method=" + MethodName);
            sb.Append("&siteid=" + SiteId);
            sb.Append("&type=" + XMLType.ToString());

            if (PollId > 0)
            {
                sb.Append("&blogid=" + PollId);
            }
            if (Culture.Trim() != "")
            {
                sb.Append("&culture=" + Culture);
            }
            if (PageSize > 0)
            {
                sb.Append("&pagesize=" + PageSize);
            }
            if (PageIndex > 0)
            {
                sb.Append("&pageindex=" + PageIndex);
            }
            if (Parameters.Trim().Length > 0)
            {
                sb.Append("&prms=" + Parameters);
            }

            if (IgnoredUriParameters.Trim() != "*" &&
                HttpContext.Current.Request.Url.Query != null &&
                HttpContext.Current.Request.Url.Query.Length > 0)
            {
                string[] prms = HttpContext.Current.Request.Url.Query.Replace("?", "").Split('&');

                //if paremeter isn't already added to the returning string
                foreach (string prm in prms)
                {
                    if (prm.Trim().Length == 0)
                    {
                        continue;
                    }

                    string prmName = (prm.Split('='))[0];

                    if (!IsInIgnoreList(prmName))
                    {
                        if (sb.ToString().ToLower().IndexOf(prmName.ToLower()) < 0)
                        {
                            sb.Append("&" + prm);
                        }
                    }
                }
            }

            if (HttpContext.Current.Request["currpostid"] != null)
            {
                sb.Append("&currpostid=" + HttpContext.Current.Request["currpostid"].ToString());
            }
            else
            if (HttpContext.Current.Request["postid"] != null)
            {
                sb.Append("&currpostid=" + HttpContext.Current.Request["postid"].ToString());
            }

            return(sb.ToString());
        }
Example #5
0
        //public string GetFilePath(string path, bool addParams)
        //{
        //    string strRtn = path;

        //    if (path.IndexOf("http:") < 0)
        //    {
        //        string root = "http://" +
        //                    HttpContext.Current.Request.Url.Host +
        //                    ":" + HttpContext.Current.Request.Url.Port;

        //        strRtn = path.Replace("~", "");
        //        if (!strRtn.StartsWith("/"))
        //            strRtn += "/";

        //        strRtn = root + strRtn;
        //    }

        //    if (addParams)
        //        strRtn += GetParamsForServiceCall();

        //    return strRtn;
        //}


        string GetParamsForServiceCall()
        {
            ContentId = GetPropertyValue("ContentId", ContentId, DefaultContentId);
            Alias     = GetPropertyValue("Alias", Alias, "");
            Lineage   = GetPropertyValue("Lineage", Lineage, "");
            //Where = GetPropertyValue("where", Where, "");
            //SortBy = GetPropertyValue("sortby", SortBy, "");
            PageSize  = GetPropertyValue("pagesize", PageSize, 0);
            PageIndex = GetPropertyValue("pageindex", PageIndex, 0);
            Culture   = GetPropertyValue("culture", Culture, "");

            StringBuilder sb = new StringBuilder("");

            sb.Append("?method=" + MethodName);
            sb.Append("&siteid=" + SiteId);
            sb.Append("&type=" + XMLType.ToString());

            if (ContentId > 0)
            {
                sb.Append("&contentid=" + ContentId);
            }
            if (Culture.Trim() != "")
            {
                sb.Append("&culture=" + Culture);
            }
            if (Alias.Trim().Length > 0)
            {
                sb.Append("&alias=" + Alias);
            }
            if (Lineage.Trim().Length > 0)
            {
                sb.Append("&lineage=" + Lineage);
            }
            if (MaxTitleLength > 0)
            {
                sb.Append("&maxtitlelength=" + MaxTitleLength);
            }
            if (MaxDescriptionLength > 0)
            {
                sb.Append("&maxdesclength=" + MaxDescriptionLength);
            }
            if (PageSize > 0)
            {
                sb.Append("&pagesize=" + PageSize);
            }
            if (PageIndex > 0)
            {
                sb.Append("&pageindex=" + PageIndex);
            }
            if (Parameters.Trim().Length > 0)
            {
                sb.Append("&prms=" + Parameters);
            }
            if (Where.Trim().Length > 0)
            {
                sb.Append("&where=" + Where);
            }
            if (SortBy.Trim().Length > 0)
            {
                sb.Append("&sortby=" + SortBy);
            }

            if (IgnoredUriParameters.Trim() != "*" &&
                HttpContext.Current.Request.Url.Query != null &&
                HttpContext.Current.Request.Url.Query.Length > 0)
            {
                string[] prms = HttpContext.Current.Request.Url.Query.Replace("?", "").Split('&');

                //if paremeter isn't already added to the returning string
                foreach (string prm in prms)
                {
                    if (prm.Trim().Length == 0)
                    {
                        continue;
                    }

                    string prmName = (prm.Split('='))[0];

                    if (!IsInIgnoreList(prmName))
                    {
                        if (sb.ToString().ToLower().IndexOf(prmName.ToLower()) < 0)
                        {
                            sb.Append("&" + prm);
                        }
                    }
                }
            }

            if (HttpContext.Current.Request["currcontentid"] != null)
            {
                sb.Append("&currcontentid=" + HttpContext.Current.Request["currcontentid"].ToString());
            }
            else
            if (HttpContext.Current.Request["contentid"] != null)
            {
                sb.Append("&currcontentid=" + HttpContext.Current.Request["contentid"].ToString());
            }

            return(sb.ToString());
        }