How to check if the user is already logged in or not using Cookie?

前端 未结 2 1038
情深已故
情深已故 2021-01-06 14:03

I want to know how can I detect if the user is already logged in or not? using a cookie. I am not using any log-in control. I have a db which checks the ID and PWD. Also pls

相关标签:
2条回答
  • 2021-01-06 14:35

    In asp.net using windows / forms authentication you can tell if the user is logged in via :

    <%
       Page.User.Identity.IsAuthenticated
    %>
    

    Forms Authentication is cookie based, but can be configured to not use cookies with the cookieless setting.

    How to fully setup forms authentication is not a quick answer but it is relatively easy to setup there are many HOW-TO's online. Here is a good one http://www.4guysfromrolla.com/webtech/110701-1.shtml

    MSDN :http://msdn.microsoft.com/en-us/library/aa480476.aspx

    You can use Windows Authentication also which does not use cookies.

    0 讨论(0)
  • 2021-01-06 14:45

    I used:

    HttpContext.Current.Request.IsAuthenticated
    
    0 讨论(0)
提交回复
热议问题