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 51787 time(s), 2 post(s) 23.01.2011 09:56:43by toddbert
toddbert

toddbert

23.01.2011 09:56:43
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?
Dieser Inhalt wurde noch nicht bewertet. 
0 Reputation 3 Total posts
denis

denis

14.02.2011 21:26:18
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.
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts