Mono Support Display module depending if user is logged in 

55662 put(a) pogledan, 2 odgovor(a), 23.1.2011. 9:56:43 - Kreirao(la) toddbert
23.1.2011. 9:56:43
0 Reputacija 3 Ukupno objava

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
14.2.2011. 21:26:18
7207 Reputacija 956 Ukupno objava

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
Ovo je MonoX demo site. Posjetite Mono Software za više detalja.