Developeing SharePoint web parts problem
-
I started developing a web part but am having some security issues with it. I am trying to do some really simple stuff as shown below.
SPWeb mySite = SPControl.GetContextWeb(Context); output.WriteLine(SPEncode.HtmlEncode(mySite.Users.Count.ToString()));
It is the SPWeb line that is giving me the security error which is:Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed.
I started by making the webpart safe in the wss_minimaltrust.config file by using the Public key. That didn't work so I upgraded the trust level to Medium in the web.config file just to see what would happen. it still broke so I upgraded the trust level to Full. It still broke! This code is used by many others all over the web but I haven't seen them having any issues. Full trust should allow everything so why am I still getting a security error? Oh, and I did iisreset between each security change just to be sure it took hold. Thanks for any help! -
I started developing a web part but am having some security issues with it. I am trying to do some really simple stuff as shown below.
SPWeb mySite = SPControl.GetContextWeb(Context); output.WriteLine(SPEncode.HtmlEncode(mySite.Users.Count.ToString()));
It is the SPWeb line that is giving me the security error which is:Request for the permission of type Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c failed.
I started by making the webpart safe in the wss_minimaltrust.config file by using the Public key. That didn't work so I upgraded the trust level to Medium in the web.config file just to see what would happen. it still broke so I upgraded the trust level to Full. It still broke! This code is used by many others all over the web but I haven't seen them having any issues. Full trust should allow everything so why am I still getting a security error? Oh, and I did iisreset between each security change just to be sure it took hold. Thanks for any help!