Nick Kahn
Nick Kahn

Reputation: 20078

Cannot retrieve the URL specified in the Content Link property

using (SPSite site = new SPSite("http://servername/sites/test/"))
       {
            PageViewerWebPart pvwp = new PageViewerWebPart();
            pvwp.Title = "My Page Viewer Web Part";
            pvwp.ContentLink = "http://www.cnn.com";
        }

Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator.

sometimes i get the error The Web Part has timed out and sometimes the above error. and i make sure that my internet is working so i opend the browser and able to access the site

Upvotes: 1

Views: 6270

Answers (1)

int32
int32

Reputation: 1687

I could not reproduce this, so i would assume it's an permission issue. Try running your code with elevated privileges:

SPSecurity.RunWithElevatedPrivileges(delegate
{
    using (var site = new SPSite("http://servername/sites/test/"))
    {
        var pvwp = new PageViewerWebPart
        {
            Title = "My Page Viewer Web Part",
            ContentLink = "http://www.cnn.com"
        };
    }
});

Upvotes: 1

Related Questions