Welcome to Office and 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

Order Your Fundamentals CD Today!Get up to speed quickly and learn how to uncover rich information management capabilities with this free SharePoint CD. IT ConnectionsDive into the new Microsoft platforms and products you implement and support with the experts from Microsoft, TechNet Magazine, Windows ITPro and industry gurus. There are 70+ sessions and interactive panels with networking opportunities. Attention User Groups & User Group Leaders...Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes. And add Windows IT Pro & SQL Server Mag articles alongside your own message!. Get Specialized SharePoint Training!SharePoint MVPs Dan Holme, Michael Noel, and Andrew Connell share their perspective and expertise in these exclusive eLearning seminars. One Event for developers and one for IT pros. Choose the one that fits your needs! Get SQL Server 2008 at SharePoint ConnectionsDon’t miss SharePoint Connections, the premier event for Microsoft IT Professionals, in Las Vegas, November 10-13. Every attendee will receive a copy of SQL Server 2008 Standard Edition with one CAL.