HowTo: Display parts of a page to anonymous users only
My ex-colleague Chris O'Brien (prolific blogger at http://www.sharepointnutsandbolts.com/) has a good post on some of the hidden gems in the SharePoint web control libraries (http://www.sharepointnutsandbolts.com/2008/03/great-controls-to-be-aware-of-when.html).
In his discussion about SPSecurityTrimmedControl he mentions some issue he has when trying to set up a section of his page to show to anonymous users, but not authenticated users. He tried:
1: <SharepointWebControls:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AnonymousUsersOnly">
2: This *should* be visible only to anonymous users but it doesn't work..
3: </SharepointWebControls:SPSecurityTrimmedControl>
This wasn't working (though it looks like it should). An alternative method is to use the standard ASP.NET control LoginView:
<asp:LoginView runat="server">
<AnonymousTemplate>
This will be visible only to anonymous users and does work…
</AnonymousTemplate>
< LoggedInTemplate>
This will be visible only to authenticated users and does work…
</LoggedInTemplate>
</asp:LoginView>
This works exactly as advertised.
This entry was posted
on Friday, June 20th, 2008 at 4:54 am and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
HowTo: Display parts of a page to anonymous users only
My ex-colleague Chris O'Brien (prolific blogger at http://www.sharepointnutsandbolts.com/) has a good post on some of the hidden gems in the SharePoint web control libraries (http://www.sharepointnutsandbolts.com/2008/03/great-controls-to-be-aware-of-when.html).
In his discussion about SPSecurityTrimmedControl he mentions some issue he has when trying to set up a section of his page to show to anonymous users, but not authenticated users. He tried:
1: <SharepointWebControls:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AnonymousUsersOnly">
2: This *should* be visible only to anonymous users but it doesn't work..
3: </SharepointWebControls:SPSecurityTrimmedControl>
This wasn't working (though it looks like it should). An alternative method is to use the standard ASP.NET control LoginView:
<asp:LoginView runat="server">
<AnonymousTemplate>
This will be visible only to anonymous users and does work…
</AnonymousTemplate>
< LoggedInTemplate>
This will be visible only to authenticated users and does work…
</LoggedInTemplate>
</asp:LoginView>
This works exactly as advertised.
This entry was posted
on Friday, June 20th, 2008 at 4:54 am and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.