Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i have a custom prop for ContentLink for PageViewerWebPart and the strange thing is that, if i enter www.yahoo.com i get this below error:

The following file(s) have been blocked by the administrator: /SitePages/www.yahoo.com 

Troubleshoot issues with Microsoft SharePoint Foundation. 

if i enter just http://www.yahoo.com its work as expected

and here is my custom webpart prop:

        private string _webPartContentLink = null;
 [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        [System.ComponentModel.Category("Services")]
        [WebDisplayName("Enter WebPart Content Link")]
        [WebDescription("Enter WebPart Content Link")]
        public string WebPartContentLink 
        {
            get
            {
                if (_webPartContentLink == null)
                {
                    _webPartContentLink = string.Empty;
                }
                return _webPartContentLink;
            }
            set 
                {

                    _webPartContentLink = value;
                }
          }



PageViewerWebPart oWebPart = new PageViewerWebPart();
oWebPart.ContentLink = WebPart.WebPartContentLink.ToString();
Controls.Add(oWebPart);
share|improve this question
    
Unsure but check your alternate access mappings to see if you have an overly-broad rule. –  Erik Noren Sep 2 '11 at 22:45
    
will you show me the steps how to do that?, i am new to SP –  Abu Hamzah Sep 2 '11 at 23:25
add comment

2 Answers 2

up vote 0 down vote accepted

According to the MSDN documentation, the ContentLink property can be a Url or file path. You can specify the SourceType property of the webpart so that it knows what to expect for the ContentLink. However, setting the SourceType property will not convert the string in the ContentLink property to a valid url. In fact, the documentation for the PathPattern, the object type that the SourceType takes, states that "you should provide your own validation code for working with the value".

You could include in the property description for the WebPartContentLink how you want the user to enter the information and then check for this in your code.

[WebDescription("Enter WebPart Content Link as http://site Url")]
share|improve this answer
add comment

According to the message you receive I think SharePoint treats the link as a relative link. With http it seems absolute and works as you expect.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.