Example #1
0
        private static string GetFormContext_UsingURL(string listPageURL)
        {
            if (string.IsNullOrEmpty(listPageURL))
            {
                return(string.Empty);
            }

            var lowerCaseURL = listPageURL.ToLower();

            if (!lowerCaseURL.Contains("xcontext") && !lowerCaseURL.Contains("context"))
            {
                return(listPageURL);
            }

            string formContext = string.Empty;
            var    urlGen      = new UrlGenerator(listPageURL);

            if (urlGen.ContainsKey("xcontext"))
            {
                formContext = urlGen.GetValueForKey("xcontext");
            }
            else if (urlGen.ContainsKey("context"))
            {
                formContext = urlGen.GetValueForKey("context");
            }

            if (string.IsNullOrEmpty(formContext))
            {
                formContext = listPageURL;
            }

            return(formContext);
        }