July 23, 2009
Iron Speed Designer V6.2 and later
This example shows how to retrieve information about currently logged user and his/her roles via a code customization.
This is applicable for all security types, including database security and Active Directory security.
C#:
BaseClasses.Utils.SecurityControls.IsUserInRole(System.Web.HttpContext.Current, "role1;role2;role3");
Visual Basic .NET:
BaseClasses.Utils.SecurityControls.IsUserInRole(System.Web.HttpContext.Current, "role1;role2;role3")
C#:
string UserID = SecurityControls.GetCurrentUserID();
Visual basic .NET:
Dim userID As String = SecurityControls.GetCurrentUserID()
This applies to retrieving Active Directory security roles.
C#:
string usrRoleStr = SecurityControls.GetCurrentUserRoles();
Visual Basic .NET:
Dim usrRoleStr As String = SecurityControls.GetCurrentUserRoles()
C#:
SecurityControls.GetCurrentUserName();
Visual Basic .NET:
SecurityControls.GetCurrentUserName()
You also can set these values and manually set the logged in user ID without using the Iron Speed Designer security layer.
See Customizing Application Security for details.
Customizing Application Security
Implementing Custom User Authentication
Example: Overriding Security at the Page Level
Example: Programmatically Accessing the Currently Logged-in User
Example: Access User Name and Password from Sign In Control
Example: Allow Only Active Users to Login
Example: Encrypting Passwords Before Saving to the Database
Example: Restrict Login after Incorrect Password Used