Checking the login status of a member.

This is a very rough draft of how the system allows developers to access login information for a current user. The public facing account system is only just now to the point I feel that any changes made to it will only involve minor syntax changes or additions in the future.

To check if a member is logged into the system or not developers my use the CheckLogin procedure found in the GuildCMS.Account.Management class. To check if a visitor to the system is logged in you can do the following:

Make sure you import the GuildCMS.Account.Management namespace into your class or code behind file or referance it directly.

An example of how to check if a user is logged in or not is as follows:

Imports GuildCMS.Account.Management

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' This is a protected page so check that the member is logged into the system using CheckLogin(True).
If CheckLogin(True) = True Then
' User is logged in...
Else
' User is not logged in...
End If
End Sub

You are able as well to specify through the CheckLogin() function as to if the visitor is required to be logged in or not to view the page you are working on. Currently CheckLogin(True) requires a user to be logged into the system in order to view the requested page. However if CheckLogin(False) is used an unauthenticated user will still be able to view the page and allow you to recognize a logged in user.

More details on the information currently stored on users once they have logged in can be found in the section Session and Cookie Values.

Last edited Mar 22, 2010 at 2:48 AM by jprochazka, version 1

Comments

No comments yet.