Automatic Login

How is it possible to login to the system without using the LoginDlg. I look into our ActiveDirectory to get the username and group to which the person belongs to. 

Now i like to use only GroupPermissions to enable and disable some features. So if i find a user which belongs to the AD Group booking i.e i will automatically look into the security system with i.e. Username booking and password booking. 

You can programmatically perform a login with uilSecurityManager.Login(username,password)