We use Sharepoint as CMS for our webpages at work. I know how to create controls that can be only visible if you have logged in in SharePoint with:
<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server" PermissionsString="AddAndCustomizePages"><br />
<Sharepoint:CssLink ID="CssLink1" runat="server"/><br />
</Sharepoint:SPSecurityTrimmedControl>
But I want to know how to make controls visible (or whatever) programmatically depending on permissions.
I cannot use the methods for .NET windows form authentication like:
if (!(HttpContext.Current.User == null) && HttpContext.Current.User.Identity.IsAuthenticated){}
because we use this for anonymous users who has another type of log in.
Could you provide some code? I know that it must be something like verifying the SPContext.Current.FormContext.