Mono Support Display module depending if user is logged in 

Viewed 52704 time(s), 2 post(s), 1/23/2011 9:56:43 AM - by toddbert
1/23/2011 9:56:43 AM
0 Reputation 3 Total posts

Hi,

I'm setting up a new site using monox and cant figure out how to only display a web part if the user is logged in (or not logged in.

The scenario is that on the home page i want to display the login web part if the user isnt logged in.

There is a way to do this using roles perhaps?

1
2/14/2011 9:26:18 PM
7207 Reputation 956 Total posts

Roles are used only for authenticated users; you will be able to do this via the following code (where myLoginCtl is the ID of your login control):

myLoginCtl.Visible = !HttpContext.Current.User.Identity.IsAuthenticated;

You can place this code in the PreRender event handler. There are alternative methods, but I guess this is the simplest one.

2
This is a demo site for MonoX. Please visit Mono Software for more info.