check if user is logged in in user control Asp.net MVC

前端 未结 4 832
情话喂你
情话喂你 2020-12-29 19:35

how can i check if a user is logged in in user control with asp.net mvc

usually on a view page i use this

<% if (User.Identity.IsAuthenticated)          


        
4条回答
  •  长情又很酷
    2020-12-29 20:11

    Well I use VB

    If User.Identity.Name = "" Then
       Response.Redirect("~/Login.aspx")
    Else
       ........continue...........
    End If
    

提交回复
热议问题