MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Display module depending if user is logged in  (Mono Support )

Viewed 48946 time(s), 2 post(s) 1/23/2011 9:56:43 AMby toddbert
toddbert

toddbert

1/23/2011 9:56:43 AM
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?
This content has not been rated yet. 
0 Reputation 3 Total posts
denis

denis

2/14/2011 9:26:18 PM
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.
This content has not been rated yet. 
7207 Reputation 956 Total posts