Welcome to Office & SharePoint Pro Sign in | Join | Help
in Search

SUBSCRIBE to Windows IT Pro Magazine & SAVE 30%      FREE Email Newsletters Vista UPDATE, Windows IT Pro UPDATE & More

Code access and webparts

Last post 08-23-2006, 2:29 AM by mm5am. 0 replies.
Sort Posts: Previous Next
  •  08-23-2006, 2:29 AM 26932

    Code access and webparts

    In my SharePoint 2007 (v3) I have a webpart where I point to a ascx-file where the code is. The webpart is build in the /bin-folder and work perfekt. But when I point to the ascx-file and the user is not a local administrator a error page i shown and the log indicates a permission error. How can I let all users to get permission to run the code in my ascx-files. I have tried to change the trust level in my web.config and to change the file security. I have used son of smart part in my SharePoint 2003 (v2) and I have the same problem there.

    namespace PV3
    {
        public class P : System.Web.UI.WebControls.WebParts.WebPart
        {

            string _PUC;

            public enum enumSample
            {
                P = 0,
                O = 1,
                U = 2,
            };

            private enumSample _P;
            [
            WebBrowsable(true),
            SPWebCategoryName("P"),
            Personalizable(PersonalizationScope.Shared),
            WebDisplayName("Funktion"),
            ]

            public enumSample GetSetP
            {
                set
                {
                    _P = value;
                }
                get
                {
                    return _P;
                }
            }

            protected override void CreateChildControls()
            {
                if ((int)_Pyramid == 0)
                {
                    _PUC = "blank.ascx";
                }
                else if ((int)_P == 1)
                {
                    _PUC = "p2_all.ascx";
                }
                else if ((int)_P == 2)
                {
                    _PUC = "p2_1.ascx";
                }
                else
                {
                    _PUC = "blank.ascx";
                }

                Control P = this.Page.LoadControl(@"/controls/" + _PUC);
                this.Controls.Add(P);
            }
        }
    }

     

View as RSS news feed in XML
SPONSORED LINKS FEATURED LINKS

SharePoint Security SimplifiediDevFactory announces that SWAT 2007® is now FREE! Order Your Fundamentals CD Today!Get up to speed quickly and learn how to uncover rich information management and deployment capabilities with this free SharePoint CD. Maximize Your SharePoint Investment: Get Your Data MovingJoin us as we take a look at the complex business of securing, accessing and managing vast amounts of information in a global network and various ways to get your data moving. SharePoint Connections event returns to Las Vegas Nov 10 - 13Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. It is co-located with Microsoft ASP.NET, SQL Server and Windows Connections with over 250 in-depth sessions. Ease Your Scripting Pains with the Flexibility of PowerShell!Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!