Groups > Web Hosting > Windows SharePoint Services > Code access and webparts




Code access and webparts

Code access and webparts
Wed, 23 Aug 2006 08:22:36 +000
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);
        }
    }
}
Post Reply
about | contact