Search KB Filter article types
Authentication CodeSample - Demo for the new 6.4 per form authentication
Categories: Authentication
Tags: Developers, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
Revision: 1
Posted: 29/Dec/2009
Updated: 23/July/2010
Status: Publish
Types: Code

This article will have a few sections added to it soon, based on the following article type skeleton: CodeSample
Overview

This code sample will demonstrate the new version 6.4 per form authentication settings.

You will see how to adjust the form settings for a per form authentication, session level authentication and no authentication, and you will also see the effect of having a context level authentication and session level authentication active on the same project.

Session level authentication is the only method used for pre 6.4 versions of Visual WebGui. This means that you set VWGContext.Current.Session.IsLoggedOn = true to signal that the user has been authenticated. This is the default setting for version 6.4.

Context level authentication, new to 6.4, means that you use VWGContext.Current.IsLoggedOn = true to signal that current context is authenticated. Having one context authentication at context level, does not mean that another context is also authenticated, meaning that you can have two different active mainform with different IsLoggedOn settings, or that you can have two different mainforms with different users logged on, provided that you store the username of the active user in a context safe place.

The session level authentication setting = true, overrides all other context level authentication settings, meaning that if you set session level IsLoggedOn = true, then all forms automatically are authenticated at context level. This means that if you have one form with context level authentication, and then another with session level authentication, then after you logon at session level, you do not get the logon form for the second mainform with context level authentication, as that is already authenticated because of the session level setting.

Samples of useweb.config authentication settings
<Applications>
      <!-- Session level authentication with different logon forms each -->
      <Application Code="FormTypeB" 
                   Type="MultiLogonTest_CSharp.FormTypeB, MultiLogonTest_CSharp" 
                   Authentication="MultiLogonTest_CSharp.LogonFormTypeB, MultiLogonTest_CSharp" 
                   Stateless="False" 
                   ForceSSL="False" />
      <Application Code="FormTypeA" 
                   Type="MultiLogonTest_CSharp.FormTypeA, MultiLogonTest_CSharp" 
                   Authentication="MultiLogonTest_CSharp.LogonFormTypeA, MultiLogonTest_CSharp" 
                   Stateless="False" 
                   ForceSSL="False" />
 
      <!-- Session level authentication with the third type of logon form -->
      <Application Code="FormGlobal" 
                   Type="MultiLogonTest_CSharp.FormGlobal, MultiLogonTest_CSharp" 
                   Authentication="MultiLogonTest_CSharp.LogonFormGlobal, MultiLogonTest_CSharp" 
                   Stateless="False" 
                   ForceSSL="False" />
 
      <!-- A form with no authentication -->
      <Application Code="FormNoLogon" 
                   Type="MultiLogonTest_CSharp.FormNoLogon, MultiLogonTest_CSharp" 
                   Authentication="None" 
                   Stateless="False" 
                   ForceSSL="False" />
</Applications>

The demo application

As seen above in the web.config settings section, the demo application has 4 mainforms. The startup form, FormNoLogon, requires no authentication and starts without a logon form. The FormTypeA and FormTypeB have seperate logon form each and they use context level authentication. Finally FormGlobal, which has it's own logon form, uses session level authentication.

The forms contain buttons to redirect back and forth between those 4 forms.

A recommended case to try is to go to FormTypeA and from there to FormTypeB and note that you are required to enter username in each case. Then go to FormGlobal and from there to either FormTypeA or FormTypeB and note that after you authenticate at session level for FormGlobal, you are not required to authentication to either of these forms, as the session is already authenticated.

Of course you can at any time redirect to FormNoLogon without authenticating, as that form does not require authentication.

SDK Version highlights

The authentication settings used in this demo, require version 6.4.0P4 or above.

RererencesCode samples
  • The demo application can be downloaded here

About the author

Related Articles

Authentication  
Title Update Author
Tags: Developers, Navigation, 1. Beginner, 2. Intermediate, 3. Advanced, Integration, Navigation, ASP.NET, v6.3, v6.4 and Later
12/Jan/2007    2007/01/12
Tags: Developers, Navigation, 2. Intermediate, 3. Advanced, ASP.NET, Pre v6.3, v6.3, v6.4 and Later
05/Jan/2009    2009/01/05
This video demonstrates how to create a logon form using the form authentication support in Visual WebGui
Tags: Architects, Developers, Windows & Dialogs, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
01/Jan/2009    2009/01/01
This video demonstrates How to create a register form using Visual WebGui
Tags: Architects, Developers, Windows & Dialogs, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
01/Jan/2009    2009/01/01
This video demonstrates How to create a register form using Visual WebGui.
Tags: Architects, Developers, Windows & Dialogs, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
02/Jan/2008    2008/01/02
This is a class to authenticate a user against Microsoft Active directory using the LDAP protocol.
Tags: Architects, Developers, Visual WebGui Pipeline, VB.NET, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
06/Jan/2010    2010/01/06
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS