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 )

51667 put(a) pogledan, 2 odgovor(a) 23.1.2011. 9:56:43Kreirao(la) toddbert
toddbert

toddbert

23.1.2011. 9: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?
Ovaj sadržaj još nije ocijenjen. 
0 Reputacija 3 Ukupno objava
denis

denis

14.2.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.
Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava