in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

Web Part accessing Web Service Security Error

Last post 10-12-2007 10:34 AM by TubaTech. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-12-2007 8:12 AM

    Web Part accessing Web Service Security Error

    Using Ted Pattison's screencast as a guide, I'm attempting to create a web part.

    This web part is going to be used for the MySites, or any site that we need to have a dynamic listing of the subsites of a site, and links to those sites.  I want the user to be able to add the web part without any need for assistance.

    Below is code I am attempting to use:

    private static XmlNode GetSites(string url, string login, string domain)
    {
    websService.
    Webs service = new websService.Webs();
    service.PreAuthenticate =
    false;
    service.Credentials =
    new System.Net.NetworkCredential(login, password, domain);

     

    service.Url = url + @"/_vti_bin/webs.asmx";

    XmlNode sites = null;

     

    sites = service.GetWebCollection();
    return sites;
    }

    Every time I attempt to run the code, I get a "Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."  Does anyone have any insight as to what exactly my issue is?  I'm using the domain/site collection administrator account...

  • 10-12-2007 10:34 AM In reply to

    Re: Web Part accessing Web Service Security Error

     I know from my SharePoint 2003 experience that this specific error can be caused by not having the right permission trust level in the web.config file.   You can either create a custom permission trust file or set the trust to full. 

    A quick google search lead me to this:

    http://www.combined-knowledge.com/Downloads/Code%20Access%20Security%20in%20SharePoint%202007%20for%20Administrators.pdf

     



     

Page 1 of 1 (2 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.