compruebe si el usuario ha iniciado sesión en control de usuario Asp.net MVC
¿Cómo puedo comprobar si un usuario ha iniciado sesión en control de usuario con asp.net mvc
Normalmente en una página de vista uso esto
<% if (User.Identity.IsAuthenticated) {%>
//Do something
<% } %>
Pero no puedo hacer esto en un control de usuario
62
Author: Dan Atkinson, 2009-08-26
4 answers
¿Funciona esto?
<%= Page.User.Identity.IsAuthenticated %>
75
Author: griegs,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-08-26 02:59:37
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-08-26 02:59:37
Nada nuevo que añadir a la respuesta Griegs, pero normalmente haría
@Request.IsAuthenticated
72
Author: Dan Atkinson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-04 12:40:32
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-04 12:40:32
Podría decorar el Método con el atributo Authorize. Esto requiere que el Usuario que llama al Método se autentique.
9
Author: CmdrTallen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-08-27 18:16:26
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-08-27 18:16:26
Bueno yo uso VB
If User.Identity.Name = "" Then
Response.Redirect("~/Login.aspx")
Else
........continue...........
End If
0
Author: Eshan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-12 09:28:48
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-12 09:28:48