- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
private string makeUrlAbsolute(string url)
        {
            isWebPartPropertiesError = false;
            try
            {
                if (!string.IsNullOrEmpty(url))
                {
                    bool shouldCheckForRootWeb = false;
                    if (!url.StartsWith("http://"))
                    {
                        if (url.StartsWith("//")) throw new Exception("Неправильная ссылка");
                        if (!url.StartsWith("/")) url = url.Insert(0, "/");
                        url = url.Insert(0, SPContext.Current.Site.Url);
                        shouldCheckForRootWeb = true;
                    }
                    using (SPSite site = new SPSite(url))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            if (!url.Contains(web.Url)) isWebPartPropertiesError = true;
                            if (shouldCheckForRootWeb && site.Url.Equals(web.Url)) isWebPartPropertiesError = true;
                            return url;
                        }
                    }
                }
                else return "";
            }
            catch
            {
                isWebPartPropertiesError = true;
                return "";
            }
            //this.CatalogIconImageUrl = this.ClassResourcePath + "/Test.ico";
            //this.TitleIconImageUrl = this.ClassResourcePath + "/Test.ico";
        }








 Follow us!
 Follow us!